Keeping the manager keeping JDO alive, not closing it?

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?

+5
source share
1 answer

, . , , - "", , . , , . , . , . PM ( ) cpu + time over, / PM .

+4

All Articles