dear community,
I have generated JSF pages from existing entities, using NetBeans 5.5
,Hibernate-3.2.0,cr4 Hibernate-entitymanager-3.2.0.cr2 .In JSF table I can see my result sets from my table debts
in PostgreSQL 8.1 database ,but when I try to edit them
or try to delete them I receive message in my browser
that " debts are successfully deleted" or "debts are successfully
updated". No errors, no exceptions,no errorneous logs in my Sun Application Server 9.
Problem is that my database remains untouched!!
I can't figure out is it a NetBeans problem or is it something with
hibernate.One user asked me:"do I use transactions?".
Generated code is starting a transaction and committing it.
Please let me know is this have a something with my "bug".
here is the code using transactions.
...
Code:
@Resource
private UserTransaction utx;
@PersistenceUnit(unitName = "HibenateAppPU")
private EntityManagerFactory emf;
private EntityManager getEntityManager() {
return emf.createEntityManager();
}
public String destroy() {
EntityManager em = getEntityManager();
try {
utx.begin();
Debts debts = getDebtsFromRequestParam();
debts = em.merge(debts);
em.remove(debts);
utx.commit();
addSuccessMessage("Debts was successfully deleted.");
}
catch (Exception ex) {
try {
addErrorMessage(ex.getLocalizedMessage());
utx.rollback();
} catch (Exception e) {
addErrorMessage(e.getLocalizedMessage());
}
}
em.close();
return "debts_list";
}
...
Any help is appreciated
best regards
Nikola