Is it usually required that the persistence manager be closed? Can you just keep one open and reuse it all the time, i.e. just repeat this template:
Transaction tx = pm.currentTransaction();
try {
tx.begin();
// do stuff
tx.commit();
} finally {
if (tx.isActive()) tx.rollback();
}
What are the disadvantages of this? It seems to make sense since you will never need to โdisconnectโ objects due to closing the save manager?
Jacob source
share