TransientObjectException : object references an unsaved transient instance ...
------------------------------------------------------------------------------
Key: HHH-2068
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2068
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.cr4
Environment: Windows, Hibernate 3.2.0.cr4, Oracle 9.2.0.1
Reporter: Ales PROCHAZKA
Attachments: XTest.zip
I found this problem:
If I create new object 'o1', which associate another persistent object
'o2' and by calling saveOrUpdate Hibernate throws PropertyValueException,
then when I corresct this property and try call saveOrUpdate in another session (in which
'o2' was not saved or loaded) Hibernate throws TransientObjectException.
Please see attached code :-)
This is a log :
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into T_TEST (A_POKUS, A_POKUS_LONG, CID, PK) values (?, ?, 3, ?)
Hibernate: insert into T_TEST3 (PK) values (?)
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select hibernate_sequence.nextval from dual
org.hibernate.PropertyValueException: not-null property references a null or transient
value: persistent.Test5.pokus
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:284)
at
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:509)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:501)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:497)
at test.MainTest.test(MainTest.java:71)
at test.MainTest.main(MainTest.java:42)
org.hibernate.TransientObjectException: persistent.Test3
at
org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
at
org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2900)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:474)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:197)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:120)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at test.MainTest.test(MainTest.java:87)
at test.MainTest.main(MainTest.java:42)
Thanx
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira