问题
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
回答1:
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="device_gen")
来源:https://stackoverflow.com/questions/10297778/ebean-looks-for-wrong-sequence-name-in-play-framework-2