openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ericp56 <eric.phettepl...@twcable.com>
Subject Transaction question
Date Wed, 17 Sep 2008 14:49:32 GMT

I am porting an application to container-managed JPA.

In my EJB, I now have a function that does something like this:

function CreateAccount() {
Person p = new Person(); 
Address a = new Address();
...
em.persist(p);
em.persist(a)
...

}

In my Web page that uses the EJB, I have added a transaction manager like
this:

InitialContext context = new InitialContext();
UserTransaction tx = (UserTransaction)
context.lookup("java:comp/UserTransaction");
tx.begin();
myEjb.CreateAccount();
tx.commit();
     
my question is, if the call to em.persist(a) fails, will the persistence of
p roll back?

I'm going to test it out.  Feel free to comment.

Thanks,

Eric
-- 
View this message in context: http://n2.nabble.com/Transaction-question-tp1095461p1095461.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message