Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deleting the object with @OneToOne mapping.  RSS feed

Faiz Chachiya
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have entity Aircraft and FlightData, which have one-to-one relationship (i.e one Aircraft can have one FlightData).

The Aircraft class is as below.

The FlightData class is as below.

I am able to Add/Update the FlightData, but when i try to delete the flight data i get the following exception

org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascad
e (remove deleted object from associations): [org.woi.dao.FlightData#4]
at org.hibernate.impl.SessionImpl.forceFlush(
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTran
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveO
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpda

Does anyone has any idea, what is causing this error.


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!