[jboss-user] [EJB 3.0] - Re: UserTransactions and merge

hoeft do-not-reply at jboss.com
Thu Nov 16 15:55:32 EST 2006

I have forgotten something: You forgot to mark the boundries of the transaction scope correctly. The transaction scope is importend, because the entitymanager persists the entities if he leaves the transaction scope. The boundries are marked by the begin() and commit() method. You forgot the begin method.

The corrected code:

  |    (...)
  |    ut.begin(); //start of the transaction scope
  |    a.setName("F002");
  |    em.merge(a) // better: a = em.merge(a)
  |    ut.commit(); //end of the transaction scope: a is persisted at this point

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986674#3986674

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986674

More information about the jboss-user mailing list