Skip to content
Advertisement

Why does Hibernate throw org.hibernate.exception.LockAcquisitionException?

I have this method :

JavaScript

Mapping :

Person.hbm.xml

JavaScript

Cars.hbm.xml

JavaScript

This method works well for a single thread, and on multiple threads, gives me an error:

JavaScript

AOP Transaction :

JavaScript

NB : When i add Thread.sleep(5000) after update, it is ok. But this solution is not clean.

Advertisement

Answer

I have Cars -> (1 -n) places. And i have a foreign key in the table place (id_car). This foreign key dont have an index. When i add an index to this foreign key, my problem is resolved.

Refer to This Answer

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement