when i execute the following:
Code:
Session hs = ..;
hs.delete(someObject);
i get exception:
net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2181)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:709)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1310)
at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)
at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2557)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2197)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2186)
I don't understand why.
Could you help me?