Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate delete exception

 
Shiva Samala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a parent table and a child table. Using Hibernate I am trying to delete a row from the parent table and all the related rows from the child table. But I am getting the following exception. Can anyone help me out??

Thanks,
Shiva.

=========================================================================

Caused by: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.dcx.wppaup.shared.domain.PromotionalPriceDO#1]
at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:883)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:168)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:493)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:487)
at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:134)
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any circular references in your Java Objects. Meaning one object has a reference to another object, which in turn has a reference back to the previous one? Or something like that.

Maybe that is what is happening?

Mark
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!