Within a transaction of a Stateless Bean method I have following code:
Account accountOne = entityManager.find(Account.class, 1L);
accountOne.setAccountBalance(100L);
List<Account> allAcounts = entityManager.createQuery("select obj from Account
obj").getResultList();
As I have discovered, triggers the last instruction getResultList indirectly the flush() method of the EntityManager. This causes by the way a database row lock of the database row which belongs to the entity accountOne.
Is there a way to get the information when hibernate is locking a row (a kind of listener or anything else)?