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

klaus_erber do-not-reply at jboss.com
Fri Nov 17 03:29:01 EST 2006


ok, thank you.

The transaction boundry was ok in my original code, but the first tip was the right one.

But there is another question. What about relationships like this:


  | UserTransaction ut = sessionContext.getUserTransaction();
  | ut.begin();
  | MyEntity a = em.find(MyEntity.class, Long.valueOf(1));
  | ut.commit();
  | 
  | ut = sessionContext.getUserTransaction();
  | ut.begin();
  | a.setName("FOO2");
  | MyRelatedBean b = a.getMyRelatedBean();
  | em.merge(a);
  | ut.commit();
  | 

Of course, that ends with a LazyInitializeException. But can I 'integrate' a bean in the transaction to use it as normal accessed (via find or Query) bean?

Greetings
Klaus

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

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



More information about the jboss-user mailing list