[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6620?page=c...
]
Laird Nelson edited comment on HHH-6620 at 8/31/11 7:33 AM:
------------------------------------------------------------
Attaching self-contained test case that shows the problem. I've turned
{{hibernate.show_sql}} on and dialed up the H2 diagnostics so that you can see exactly
what the H2 driver sees. Note that the ID being inserted is {{1}}, not {{5001}}, i.e.
that the {{initialValue}} attribute is being ignored as described.
was (Author: ljnelson):
Attaching self-contained test case that shows the problem. I've turned show_sql on
and dialed up the H2 diagnostics so that you can see exactly what the H2 driver sees.
Note that the ID being inserted is 0, not 5000, i.e. that the initialValue attribute is
being ignored as described.
@TableGenerator-governed sequence table insertion problems
----------------------------------------------------------
Key: HHH-6620
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6620
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core
Affects Versions: 3.5.0-Final
Environment: May affect other versions besides 3.5.0-Final
Reporter: Laird Nelson
Labels: jpa2
Attachments: hhh-6620.zip
The JPA specification is admittedly mum on this, but Hibernate serves up some surprising
behavior.
Suppose you have a sequence table that is created according to the requirements of a
particular {{@TableGenerator}} annotation. So two columns, storing a sequence name and a
sequence value. Suppose this sequence table is created by some DDL script somewhere, and
Hibernate's automatic schema creation is deliberately switched off.
Hibernate will helpfully insert new rows into this table as required, but when it does so
it does not honor the {{initialValue}} attribute of the {{@TableGenerator}} annotation in
question.
I will supply a test case once I get the bug number.
The workaround is obviously to manually insert a row into this table with the appropriate
initial value, but then of course the {{initialValue}} attribute is largely useless.
OpenJPA handles this case flawlessly.
EclipseLink doesn't even attempt to perform the insertion.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira