This content has been marked as final.
Show 3 replies
-
1. Re: EntityManager transaction in a Seam managed Servlet
giomiano May 19, 2009 10:44 AM (in response to giomiano)Actually I did not reliazed about Transaction ;)
Transaction.instance().begin();
Transaction.instance().commit();
Hope helps in future
-
2. Re: EntityManager transaction in a Seam managed Servlet
jonathanb Oct 14, 2009 12:45 AM (in response to giomiano)I am attempting something similar but can't seem to get a result. My query in the servlet works fine, but my update appears not to generate sql (based on hibernate show sql true) and I get no effect in the database. I have:
EntityManager em = (EntityManager) Component.getInstance("entityManager");
...
UserTransaction txn = Transaction.instance(); txn.begin(); enquiry.setStatus(status); em.persist(enquiry); txn.commit();
My servlet includes an @Name annotation, other than that its a standard servlet. There is no conversationId being passed to the servlet. Any help would be much appreciated.
-
3. Re: EntityManager transaction in a Seam managed Servlet
kapitanpetko Oct 14, 2009 1:07 PM (in response to giomiano)Since there is no tx active when you call getInstance, your entity manager
knows nothing about your transaction. You need to call em.joinTransaction() after txn.begin().