JBoss Community

Pessimistic lock outside singleton bean.

created by Michael Korotin in EJB3 - View the full discussion

Hello!

 

I am  using pessimistic lock in jpa 2 and ejb3.1. When i call find method for my entity(

     BalanceEntity balanceEntity = em.find(BalanceEntity.class, 1L)

), after that i call line 2:

 

     em.refresh(balanceEntity, LockModeType.PESSIMISTIC_WRITE);//line 2

     //change balanceEntity

 

The line 2 does not work in Stateless bean, but it works in singleton bean.

Can i use pessimistic lock outside singleton bean?

 

Thank you.

Reply to this message by going to Community

Start a new discussion in EJB3 at Community