How to deal with Spring hibernate no lock aquired exception inside a transaction
NickName:Sayed Uz Zaman Ask DateTime:2020-05-19T23:29:48

How to deal with Spring hibernate no lock aquired exception inside a transaction

I have applied @Transactional in my interface, and inside my serviceImpl, the corresponding method is calling some other methods, one method is reading, another method is writing. Although I have anotated as Transactional, when I am giving concurrent request, my insert method is throwing org.hibernate.exception.LockAcquisitionException: error. Another problem is, this insert method is a shared method and it performs the insert method like Dao.save(obj) . Dao.save() is a generic method So i can not do anything here. I have to apply something on interface to avoid no lock aquired exception. Is it possible to tell wait untill lock is aquired? Or retry if transaction is failed? Or lock all the tables until the transaction is completed so that another request can not access the relevent resources? My hibernate version is 3.x, And database is mysql 5.6

Copyright Notice:Content Author:「Sayed Uz Zaman」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/61894831/how-to-deal-with-spring-hibernate-no-lock-aquired-exception-inside-a-transaction

More about “How to deal with Spring hibernate no lock aquired exception inside a transaction” related questions

How to deal with Spring hibernate no lock aquired exception inside a transaction

I have applied @Transactional in my interface, and inside my serviceImpl, the corresponding method is calling some other methods, one method is reading, another method is writing. Although I have

Show Detail

How to use LOCK IN SHARE MODE with hibernate/spring?

I'm running into a deadlock scenario when using MySQL and Hibernate (with Spring). I'm getting the following exception message: could not get or update next value; SQL[null]; nested exception ...

Show Detail

How to deal with Hibernate exceptions in standalone Java app

Exceptions thrown by Hibernate are unchecked and from what I've read elsewhere it seems that they are not supposed to be caught in code. However, this means that when for example a temporary database

Show Detail

In java spring hibernate 3.6.3 how to tell a method to wait until lock is aqured and how to retry a failed transaction?

In my spring application I am facing failed to acquire lock issue and transaction is getting failed. It is not even rollbacking the transaction as database is not providing the lock. How to tell a ...

Show Detail

Transaction management with Spring and Hibernate

We have part of the system in Spring and part of the system is non Spring based. Now we are deprecating all the calls using hibernate template to session.getCurrentSession. Also we are using the s...

Show Detail

Spring Hibernate transaction exception rollback

Update 12/12/2011 The application is making use of a Generic DAO class that can be found here. Based on re-reading the spring manual on the usage of @Repository it would appear that I need to add...

Show Detail

Transaction Required Exception in JPA Spring Hibernate App

I saw many posts in this forum regarding the Transaction required Exception. But none of them resolved the issue. My question is: In my scenerio, my application is working perfectly for some

Show Detail

Hibernate transaction management without Spring

i want to use Hibernate without Spring, i setup Hiberante in this way: <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property> <property

Show Detail

hibernate transaction will lock the row in table(MySQL)

I am using Hibernate3.2 in my DAO layer. I need to know, hibernate will do the row level lock after transaction is started. Hibernate do the lock after start the transaction or while commit the

Show Detail

Hibernate vs Spring connection acquisition strategy

I'm trying to understand when exactly a database connection is aquired in an application that uses hibernate as an ORM & Spring for transaction management. In this article, it says: If the

Show Detail