18

I have an id:

@Column(name = "device")
@GeneratedValue(strategy = GenerationType.AUTO, generator = "device_gen")
@SequenceGenerator(name = "device_gen", sequenceName = "device_id")
@Id
public Integer id;

SequenceGenerator defines the sequenceName as device_id but trying to save an entity I get the error: relation "public.device_seq" does not exist.

Why is it looking for device_seq instead of device_id?

I'm using PostgreSQL

Rob Fox
  • 4,725
  • 5
  • 32
  • 59
  • 1
    I know Anorm had similar issues (with prefixes) due to PostgreSQL JDBC driver, so I suspect that's the case, but I can't guarantee it. If you could try and make sure this works in MySQL, then you could raise a bug for Play/Ebeans on it. – Pere Villega May 02 '12 at 09:30
  • @PereVillega I know it works with H2. When I have time I will look into trying it with MySQL – Rob Fox May 02 '12 at 09:33
  • 1
    if it works with h2, then please raise the bug in Play and Ebeans forums, as it is likely a bug in one of them. They may know a workaround – Pere Villega May 02 '12 at 10:01
  • @PereVillega Now that I am looking at the project I see that I was lying about H2. I had en existing PostgreSQL database, and H2 was evolved by play itself. – Rob Fox May 02 '12 at 14:42
  • 1
    @RobFox Was that the solution? If so you should post with an explanation in case someone else runs across this problem. – Nathaniel Ford Jun 19 '12 at 17:48

1 Answers1

1
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="device_gen")
ndeverge
  • 20,808
  • 4
  • 54
  • 84
jittakal
  • 919
  • 6
  • 8