public static void flush(PersistenceManager pm) {
Transaction tx = pm.currentTransaction();
// flush updates to the database if transaction is active.
if (tx != null && tx.isActive()) {
PersistenceManagerWrapper pmw = (PersistenceManagerWrapper)pm;
PersistenceManagerImpl pmi =
(PersistenceManagerImpl)pmw.getPersistenceManager();
pmi.internalFlush();
}
}