]
Mike Youngstrom commented on HHH-5042:
--------------------------------------
Created an issue HHH-5230 to track this regression.
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, 3.5.1
Environment: Hibernate: 3.5 , db: HSQLDB (not relevant)
Reporter: Guenther Demetz
Assignee: Steve Ebersole
Priority: Critical
Fix For: 3.5.2, 3.6
Attachments: TestHiloGenerators.jar, TestTableGenerator.java
Time Spent: 3h 35m
Remaining Estimate: 0h
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: