Quantcast
Channel: How to set a lock for the entire entity or table in hibernate - Stack Overflow
Browsing index pages (3 articles)
↧

How to set a lock for the entire entity or table in hibernate

I want to lock a table at the entity level in Hibernate/Spring Data JPA.This is a mock-up of my code:@Entity@Data@Table(name = "Armor")public class Armor { @Id @GeneratedValue(strategy =...

View Article


Answer by Andres for How to set a lock for the entire entity or table in...

Use the following:setLockMode(String alias, LockMode lockMode)

View Article


Answer by Marcin Kunert for How to set a lock for the entire entity or table...

Maybe @Lock is what you are looking for.@Lock(LockModeType.PESSIMISTIC_READ)public Optional<Armor> findById(Long armorId);

View Article
Browsing index pages (3 articles)


Latest Images