Quando usar EntityManager.clear ()?
Uma classe de mapeador JPA customizada possui um método:
removeUser()
1. execute 'DELETE' HQL query to remove user
2. call getEntityManager().flush();
3. call getEntityManager().clear();
Se eu entendi clear () corretamente, ele irá remover do contexto todas as entidades persistentes.-fonte
No entanto, eu também leioAqui,
you should define clear architecture- and design guidelines about where a
clear() can be called.
Quais são as diretrizes claras sobre quando chamar clear ()?