Hi
A strange error which I cannot reproduce drives me crazy.
It is a desktop application and the data are modified on a single PC.
All entities extend a base entity with the following definition for the identifier:
Code:
@Id @GeneratedValue(generator="hibseq")
@org.hibernate.annotations.GenericGenerator(name="hibseq", strategy="hilo",
parameters = {
@org.hibernate.annotations.Parameter(name="table", value = "ENTITY_HI_VALUES"),
@org.hibernate.annotations.Parameter(name="column", value = "HI"),
@org.hibernate.annotations.Parameter(name="max_lo", value = "5")
}
)
public Long getId() {
return id;
}
This means that all entities use the same generator.
The database is DB2. The relevant configuration is:
Code:
<!-- Hibernate connection pool -->
<property name="c3p0.min_size">2</property>
<property name="c3p0.max_size">5</property>
<property name="c3p0.timeout">5000</property>
<property name="c3p0.max_statements">50</property>
<property name="c3p0.idle_test_period">3000</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.use_second_level_cache">false</property>
<!-- property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> -->
During development this worked fine. But now in production the generator seems to “jump” and to deliver inconsistent values. On one occasion the id was 82 whereas the ENTITY_HI_VALUES.HI was 264. Consequently a constraint violation exception resulted.
The ids in the database show that on another occasion the id jumped from 524 to 3150. Later on it jumped again causing a constraint violation. ENTITY_HI_VALUES.HI was 535 which does not make sense looking at the stored ids.
I am quite lost and am very thankful for any help.
Regards, Martin