• Post Reply Bookmark Topic Watch Topic
  • New Topic

Deadlock

 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi you all.

I have an Entity called Echeque, it has a Many-to-one relationship with another entity called Beneficiary.


When I am all done with the echeque object loaded from the database. I noticed that hibernate runs the following sql:



My problem is i dont want hibernate running this update unless i call session.update on the Beneficiary Entity.

I have tried using this annotation @org.hibernate.annotations.Entity(selectBeforeUpdate = true). But i cant seem to stop this update from happening.

Any ideas how to prevent hibernate from updating this entity when its not needed.

Why I am trying to prevent this update is because it causes a deadlock whenever i have several Echeques referencing the same beneficiary. And im trying to concurrently update just the data that has changed in each Echeque object.

help please.
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ola,

Not sure if you are using annotations. Did you try using CascadeType. I believe this option should be available in hibernate to not casacade through references.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!