I’m using EJB3 and I have a problem related to refreshing my EntityManager.
The problem is that my apllication must be prepared for use by many people but if one person updates the same date, the EntityManager is not bloking that row and it doesn’t see the changes other people do after x minutes.
Does anybody know how to refresh an EntityManager when I do a ‘select’, ‘insert’, ‘update’ or ‘delete’?
This is a concurrency issue, you should read the JPA Specification section 3.4 on Locking and Concurrency. This covers optimistic and pesimistic locking plus the use of versioned attributes.
Aditionally section 3.2.5 covers how to refresh an entity instance.