lundi 23 mars 2015

Hibernate increase Dead-Lock Timeout

I have a web application (Spring framework) having SOAP Web services (Hibernate for Persistence) that are called from external systems. When the call volume is high it is throwing alot of Dead-Lock exceptions.



Transaction (Process ID 59) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.



A read WS call is being made say about 100ms or so, and it happens when an update call comes in. When updating the object, hibernate generates a Delete and then Insert statement for a set of its children that are composite elements. So it is understandable that Dead-Lock will occur. While I find a solution for this (a retry solution maybe, please advise if you have something on top your mind), I would like to increase the dead-lock timeout.


The database is MS-SQL 2008 and it has SET LOCK_TIMEOUT statement for this, however, we cannot do that since the database is shared.


In hibernate I found this property, which is suppose to wait forever on a lock:



javax.persistence.lock.timeout=-1


But this seems to have no affect, probably that this is for JPA? and my project is not a JPA one.


Is there a way to increase the Dead-Lock timeout in hibernate core or spring-framework?


Thank you


Aucun commentaire:

Enregistrer un commentaire