Does a persistence manager generally need to be closed? Can you just keep one open and re-use it all the time, ie just repeat this pattern:
Transaction tx = pm.currentTransaction();
try {
tx.begin();
// do stuff
tx.commit();
} finally {
if (tx.isActive()) tx.rollback();
}
What are the downsides of this? It seems to make sense as you would never need to 'detatch' objects due to the persistence manager being closed?