Problem with HSQLDB & SequenceGenerator
Posted
by Srirangan
on Stack Overflow
See other posts from Stack Overflow
or by Srirangan
Published on 2010-04-21T08:46:39Z
Indexed on
2010/04/24
4:43 UTC
Read the original article
Hit count: 343
Hi,
I have an entity which has an ID field:
@Id
@Column(name = "`U##ID_VOIE`")
@GeneratedValue(generator = "VOIE_SEQ")
private String id;
The class has the sequence generator defined as well:
@SequenceGenerator(name = "VOIE_SEQ", sequenceName = "VOIE_SEQ")
and the Oracle schema has the requisite sequence present. Everything works okay.
We also have tests, which uses an in-memory HSQLDB. Before running the tests, all the tables are created based on the Hibernate entity classes.
However the table for this particular class is not being created. And error pops up, because ID is a String and the SequenceGenerator in HSQLDB returns an INT / LONG / Numeric value.
The application is using a legacy Oracle database and ID_VOIE column must remain a String / Varchar.
Any solutions?
© Stack Overflow or respective owner