]
Guenther Demetz updated HHH-5042:
---------------------------------
Attachment: TestHiloGenerators.jar
Also classes TableHiLoGenerator and SequenceHiLoGenerator are affect of the same bug.
Please see attached Testcase
TestHiloGenerators.jar (please ignore the prior testcase attachment )
It also contains patches (based on version 3.5-CR2) for classes
MultipleHiLoPerTableGenerator.java and TableHiLoGenerator.java
(testcase + patch on SequenceHiLoGenerator still todo).
TableGenerator does not increment hibernate_sequences.next_hi_value
anymore after having exhausted the current lo-range
-----------------------------------------------------------------------------------------------------------------------
Key: HHH-5042
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5042
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0.Beta-1, 3.5.0-Beta-2, 3.5.0-Beta-3, 3.5.0-Beta-4, 3.5.0-CR-1,
3.5.0-CR-2
Environment: Hibernate: 3.5 , db: HSQLDB (not relevant)
Reporter: Guenther Demetz
Priority: Critical
Attachments: TestHiloGenerators.jar, TestTableGenerator.java
This bug is new in 3.5
In version 3.5 class MultipleHiLoPerTableGenerator.java was modified introducing a
new increment variable
IntegralDataTypeHolder value;
along with
int lo;
The problem in the new code is that only value get's incremented whilst variable lo
is still used to check when a new hiVal must be obtained.
if ( lo > maxLo ) {
IntegralDataTypeHolder hiVal = (IntegralDataTypeHolder) doWorkInNewTransaction( session
);
as lo is never incremented, MultipleHiLoPerTableGenerator continues to deliver numbers
without ever update
hibernate_sequences.next_hi_value on the database (only one unique update is propagates
at the first insert)
This lead to duplicate keys as soon another session from another sessionfactory tries to
insert new objects on the concerning table.
Please see attached testcase.
IMPORTANT ADVICE TO RUN THE TESTCASE:
as the testcase uses 2 sessionfactories hibernate.hbm2ddl.auto=create cannot be used!!
Schema has to be exported separately and the testcase must run without hbm2ddl.auto
property!
Here the schema for HSQLDB:
create table A (oid bigint not null, name varchar(255), version integer not null, primary
key (oid), unique (name))
create table hibernate_sequences ( sequence_name varchar(255), sequence_next_hi_value
integer )
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: