When using a directed Graph structure model like this:
-
Graph, consists of set of nodes
-
Node, consists of set of neighbors
... and using it to create a sufficiently large closed Node Ring (about 3000 nodes), EntityManager.merge(graph) throws a StackOverflowError.
EntityManager.persist(graph) works fine. Loading via HQL works as well, only EntityManager.merge(graph) seems to be affected.
I have attached a zipped, self-contained Eclipse Project that contains a minimal test case. Just run "src/test/java/test/JUnitTest.java" as a JUnit test.
This is somewhat related to this closed bug: https://hibernate.atlassian.net/browse/HHH-3046
The repeating part of the Stack Trace is:
at org.hibernate.engine.spi.CascadingActions$6.cascade(CascadingActions.java:277) at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:350) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:293) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:379) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:319) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:296) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:118) at org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:460) at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:255) at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:317) at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:186) at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:886) at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:868)
|