• Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring method synchronization

 
Sivakumar SandeepKumar Jakkaraju
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I have a spring/jpa based application where all the beans are in default scope. I have services in jars.

When I use these in a spring batch application in multi-threaded way (using partitions ans AsyncTaskExecutors).

I am getting below exception

org.springframework.dao.CannotAcquireLockException: Deadlock found when trying to get lock; try restarting transaction; SQL [n/a]; nested exception is org.hibernate.exception.LockAcquisitionException: Deadlock found when trying to get lock; try restarting transaction
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.

basically multiple threads are trying access a same entity.

How can I fix this.

Any Help is appreciated.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!