Accessing an object containing a *ToOne-Association using NO_PROXY option for lazy
fetching
-------------------------------------------------------------------------------------------
Key: HHH-5112
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5112
Project: Hibernate Core
Issue Type: Bug
Components: core, envers
Affects Versions: 3.5.0-Final, 3.3.2
Environment: Oracle, instrumentation using Javassist
Reporter: Saša Obradović
Attachments: enversbug.jpg, field [id] not found.zip, oracle-ddl.sql
Adding an element to a collection:
{{A a = entityManager.find(A.class, 505L);}}
{{B b = new B();}}
{{a.addToB(b);}}
results in following exception:
{quote}
javax.persistence.PersistenceException: org.hibernate.PropertyNotFoundException: field
[id] not found on org.hibernate.intercept.LazyPropertyInitializer$1
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1179)
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1112)
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1118)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:738)
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
at $Proxy90.flush(Unknown Source)
at
org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
at $Proxy90.flush(Unknown Source)
at
at.ing.diba.helper.TestMethodFlusherBeanAspect.executeFlush(TestMethodFlusherBeanAspect.java:27)
at at.ing.diba.service.architektur.BugTest.testEnvers_aroundBody6(BugTest.java:69)
at at.ing.diba.service.architektur.BugTest$AjcClosure7.run(BugTest.java:1)
at
at.ing.diba.manager.ServiceMethodTracingAspect.traceServiceMethod(ServiceMethodTracingAspect.java:40)
at at.ing.diba.service.architektur.BugTest.testEnvers(BugTest.java:65)
at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:158)
Caused by: org.hibernate.PropertyNotFoundException: field [id] not found on
org.hibernate.intercept.LazyPropertyInitializer$1
at
org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:182)
at
org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:174)
at
org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:197)
at
org.hibernate.envers.entities.mapper.id.SingleIdMapper.mapToMapFromEntity(SingleIdMapper.java:104)
at
org.hibernate.envers.entities.mapper.relation.ToOneIdMapper.mapToMapFromEntity(ToOneIdMapper.java:68)
at
org.hibernate.envers.entities.mapper.MultiPropertyMapper.map(MultiPropertyMapper.java:86)
at
org.hibernate.envers.synchronization.work.ModWorkUnit.<init>(ModWorkUnit.java:48)
at
org.hibernate.envers.event.AuditEventListener.onPostUpdate(AuditEventListener.java:165)
at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:199)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:178)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:180)
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:735)
... 47 more
{quote}
The exception is related to the association between A and C, although it hasn't
changed in the transaction. No exception is thrown if the lazy fetching of C (in class A)
is declared "proxy".
--
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