[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2572?page=c...
]
Gail Badner updated HHH-2572:
-----------------------------
Attachment: HHH-2572.patch
I believe this is the same issue as HHH-2542.
I am attaching a patch for a new test to be added to
org.hibernate.test.component/basic/ComponentTest.testMergeComponent(), based on the test
case provided by Nguyen Hau Giang.
I added the following to Employee:
- an optional component, optionalComponent;
- a Set of Employee objects, directReports.
NullPointerException is thrown when a detached Employee is merged with new element added
to directReports that has a null OptionalComponent. Note that this exception is thrown
when the child element has a null component, as opposed to the grandchild element as
reported earlier.
The stack trace is as follows:
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)
at
org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:64)
at
org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:70)
at
org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:83)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:353)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:348)
at org.hibernate.type.TypeFactory.replaceAssociations(TypeFactory.java:535)
at
org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:366)
at
org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:195)
at
org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at
org.hibernate.event.def.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:407)
at
org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:266)
at
org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:120)
at
org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
at
org.hibernate.test.component.basic.ComponentTest.testMergeComponent(ComponentTest.java:228)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
org.hibernate.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:101)
at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:34)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
I am currently testing the fix provided in HHH-2542 to see if it resolves this issue.
NullPointerException when cascade-merge detached entity graph that
contains null component property
---------------------------------------------------------------------------------------------------
Key: HHH-2572
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2572
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.3
Environment: hibernate 3.2.3 only
Reporter: Nguyen Hau Giang
Priority: Critical
Attachments: HHH-2572.patch, testCase.zip
when merging detached entity graph whose leaf-entity contains null-component property,
hibernate 3.2.3 will throw NPE. (leaf-entity level>2)
No exception was thrown in hibenate 3.2.2
Mapping:
Parent -> Child -> GrandChild
All associations is cascade.
GrandChild contains a component property.
Test Case:
parent=<load>;
child=parent.get1Child();
GrandChild grandChild=new GrandChild();
grandChild.setComponent(null);
child.add(grandChild);
evict(parent);//session is closed
...
merge(parent);//merge in new sesson -> THROW NullPointerException
for further detail, see attache test case.
--
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