A custom JPA mapper class has a method:
removeUser()
1. execute 'DELETE' HQL query to remove user
2. call getEntityManager().flush();
3. call getEntityManager().clear();
If I understand clear() correctly, it will remove from context all persistent entities. -source
However, I also read here,
you should define clear architecture- and design guidelines about where a
clear() can be called.
What are clear guidelines on when to call clear()?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…