A custom JPA mapper class has a method:
removeUser()
1. execute \'DELETE\' HQL query to remove user
2. call getEntityManager().flush();
3. call getEntityMan
The articles explains it. Clearing the entity manager empties its associated cache, forcing new database queries to be executed later in the transaction. It's almost never necessary to clear the entity manager when using a transaction-bound entity manager. I see two reasons to clear: