The Artima Developer Community
Sponsored Link

Java Answers Forum
JSF CRUD and hibernate

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Nikola Radakovic

Posts: 1
Nickname: niki600
Registered: Jul, 2006

JSF CRUD and hibernate Posted: Oct 27, 2006 2:30 PM
Reply to this message Reply
Advertisement
dear community,

I have generated JSF pages from existing entities, using NetBeans 5.5
and hibernate.In JSF table I can see my result sets from my table debts
in PostgreSQL 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.

...
@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 = getDugoviFromRequestParam();
debts = em.merge(dugovi);
em.remove(dugovi);
utx.commit();
addSuccessMessage("Dets 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

Topic: Dashed line suddenly became solid line! Previous Topic   Next Topic Topic: getwidth() function in a tree datastructure

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use