0

Having Item is an entity which contains List of Boms as association, when item is being updated then order of boms updates need to updated based on primary key to prevent the database deadlock if same item entity is being updated from other session.

problem solution reference here

As per above link hibernate.order_updates then associated entities will update in primary key order such a way we can prevent concurrent updates and this is fine.

But after adding hibernate.order_updates property to true, main Item entity is updated after associated bom entities updated, need to update Item entity is first and then associated bom entities to prevent the item level concurrency.

How to do this, is there any configuration in hibernate. Please suggest how to move forward.

Currently we are in Spring4 and hibernate 4.

Community
  • 1
  • 1
Dhorrairaajj
  • 55
  • 11
  • I think this use case would require a pessimistic locking - http://stackoverflow.com/questions/6872083/spring-pessimistic-locking – ring bearer Jul 14 '15 at 08:03
  • @ring bearer-- Thanks for reply. We have practice to follow optimistic locking overall the application and we cannot use pessimistic locking, i am looking for an alternative – Dhorrairaajj Jul 14 '15 at 10:12

0 Answers0