Caspian Borison, after discussing on the hibernate-dev mailing list, we agree that this is a bug. Hibernate should ensure that the entity retains the same LockModeType. I made some changes to your test case so that, after refreshing the entity, a second EntityManager with its own transaction was used to find the same entity while the first transaction was still open. It appears that the original database lock in the first transaction blocks the load from the second transaction. Did you see this behavior as well? In other words, in your testing, did you actually find that the database lock was released after refreshing, and that a second transaction was able to update the entity? |