[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5133?page=c...
]
Gail Badner commented on HHH-5133:
----------------------------------
Ramon,
Was this working in 3.3.2?
Please attach a runnable test case (Java + mapping) that reproduces this issue.
Refresh causes assertion failure on OneToMany (cascaded) property
with new members
----------------------------------------------------------------------------------
Key: HHH-5133
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5133
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1
Environment: Oracle 10g
Reporter: Ramon Casha
An entity with a OneToMany property (cascade=all) is retrieved from the DB, then a NEW
instance is added to the OneToMany property. If you call refresh on the parent it will
give an assertion failure because Hibernate tries to refresh the added object although it
is not persistent.
eg:
class Child { }
class Parent {
@OneToMany(cascade=ALL) List<Child> children;
}
Parent p = em.find(Parent.class, 1);
p.children.add(new Child());
em.refresh(p);
This causes:
org.hibernate.AssertionFailure: null identifier
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:61)
at
org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:102)
at org.hibernate.impl.SessionImpl.fireRefresh(SessionImpl.java:1117)
at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:1100)
at org.hibernate.engine.CascadingAction$3.cascade(CascadingAction.java:203)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
at org.hibernate.engine.Cascade.cascade(Cascade.java:161)
at
org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:127)
at
org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:62)
at org.hibernate.impl.SessionImpl.fireRefresh(SessionImpl.java:1108)
at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:1088)
at
org.hibernate.ejb.AbstractEntityManagerImpl.refresh(AbstractEntityManagerImpl.java:734)
at
org.hibernate.ejb.AbstractEntityManagerImpl.refresh(AbstractEntityManagerImpl.java:709)
--
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