[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4547) IdGenerator + CompositeId = HibernateException: identifier of an instance of _ was altered
David M. Lee (JIRA)
noreply at atlassian.com
Thu Nov 5 13:21:09 EST 2009
IdGenerator + CompositeId = HibernateException: identifier of an instance of _ was altered
------------------------------------------------------------------------------------------
Key: HHH-4547
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4547
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: Hibernate 3.3.2, seen on HSQLDB and PostgreSQL
Reporter: David M. Lee
Priority: Minor
Attachments: composite-key-bug.tar.gz
I have some legacy code that I'm working with that uses composite-id for some entities, and has an IdGenerator for the id's.
The generator generates the id's correctly, but they do not get set on the entities when they are saved. For the base class, this results in the following exception:
org.hibernate.HibernateException: identifier of an instance of org.hibernate.example.compositeid.EntityWithCompositeId was altered from CompositeId{id1=1, id2=1} to CompositeId{id1=null, id2=null}
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:81)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:187)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:143)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
Strangely, on subclasses we do not get this exception. I've attached an example, which has a couple of unit tests that demonstrate the problem.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list