Hi,
I'm using hibernate 3.5.0-CR2 with MySQL server 5.1.44 (through mysql-connector-java-5.1.9) on Windows. I'm using JPA 2.0 and using the @TableGenerator to generate ids as below:
@Id @GeneratedValue(strategy=GenerationType.TABLE, generator="EnterpriseSequence") @TableGenerator(name="EnterpriseSequence", table="sequencetable", pkColumnName="sequenceName", valueColumnName="sequenceCount", pkColumnValue="EnterpriseSequence", allocationSize=1) private long id;
When allocationSize=1 then everything works fine. The ids are generated and the sequence count in the database is updated. But when allocationSize > 1, even after the allocationSize number of ids are used up hibernate doesn't seem to go get the next sequence count to base the id generation on (i.e. the sequence count in not updated in database). When app is started up again, it reads the sequence count which is now incorrect and generates ids which have been already used. According to the log output, MultipleHiLoPerTableGenerator is being used.
Len
|