This code work fine and deployed. But after some time or some days the flushed data not reflected in DB
protected boolean update(Object entity) {
EntityManager entityManager = null;
try {
entityManager = this.createEntityManager();
EntityTransaction tx = entityManager.getTransaction();
try {
tx.begin();
entityManager.merge(entity);
entityManager.flush();
tx.commit();
return true;
} catch (Exception e) {
logger.error("Exception thrown in update(): " + e.getMessage());
tx.rollback();
return false;
}
} catch (Exception e1) {
logger.error("Exception thrown in create(): " + e1.getMessage(), e1);
return false;
} finally {
if (entityManager != null && entityManager.isOpen()) {
this.closeEntityManager(entityManager);
}
}
}
this my parent dao update method.
tx in advance.