Reviewing the stack I recognized something strange in following section:
Code:
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:241)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:291)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:239)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:192)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:319)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:265)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:242)
It seems that for every element in the collection, hibernate calls cascadeToOne which
calls saveOrUpdate on your pathsGroup object.
Therefore it seems that saveOrUpdate on pathsGroup object will be called 100.001 times instead to one time only.
I'm not completely sure it is really happening this, but
if I will find the time next days I will try debug it with breakpoint at Cascade.java:291 ,
(which version of hibernate are you using)?
We have to find out which object is saveOrUpdated due the cascadeToOne action,
if it is pathsGroup itself or not...