I have a JPA entity with:
@Id
@Column(name = "id", columnDefinition = "INT")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
and using EntityManager.merge
by default
For testing I'm using HSQL that default its "auto increment" setting to 0
whenever I create a new object, my default int id will be set to 0, and the merge operation, instead of inserting the object as a new record, will update it instead.
any idea how to solve this?
One option I tried without success is to set the default "auto increment" of HSQL to 1 (not altering a specific column using RESTART)
thanks!
Aucun commentaire:
Enregistrer un commentaire