Ebean looks for wrong sequence name in Play Framework 2
Asked Answered
E

1

17

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

Elusion answered 24/4, 2012 at 12:25 Comment(5)
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.Ruffi
@PereVillega I know it works with H2. When I have time I will look into trying it with MySQLElusion
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 workaroundRuffi
@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.Elusion
@RobFox Was that the solution? If so you should post with an explanation in case someone else runs across this problem.Etude
H
1
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="device_gen")
Happ answered 24/6, 2012 at 13:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.