doPersistAction(warning, SAVE_OPERATION);
}
private void doPersistAction(Object obj, int operation) throws YPersistenceException {
try {
Session session = _factory.openSession();
Transaction tx = session.beginTransaction();
if (UPDATE_OPERATION == operation) {
session.update(obj);
} else if (DELETE_OPERATION == operation) {
session.delete(obj);
} else if (SAVE_OPERATION == operation) {
session.save(obj);
}
session.flush();
session.evict(obj);
tx.commit();
session.close();
} catch (HibernateException e) {
throw new YPersistenceException("Hibernate problem: " + e.getMessage(), e);
}
}