List of usage examples for javax.persistence PessimisticLockScope EXTENDED
PessimisticLockScope EXTENDED
To view the source code for javax.persistence PessimisticLockScope EXTENDED.
Click Source Link
PessimisticLockScope.NORMAL, element collections and relationships owned by the entity that are contained in join tables will be locked if the javax.persistence.lock.scope property is specified with a value of PessimisticLockScope.EXTENDED. From source file:com.vladmihalcea.HibernateCascadeLockComponentTest.java
@Test public void test() { final Long parentId = cleanAndSaveParent(); transactionTemplate.execute(new TransactionCallback<Void>() { @Override//from w ww. j a v a 2 s . c o m public Void doInTransaction(TransactionStatus transactionStatus) { Post post = entityManager.find(Post.class, parentId); entityManager.lock(post, LockModeType.PESSIMISTIC_WRITE, Collections .singletonMap("javax.persistence.lock.scope", (Object) PessimisticLockScope.EXTENDED)); return null; } }); }