About Question enthuware.oce-jpad.v6.2.513 :

Moderator: admin

Post Reply
ericrlessa
Posts: 5
Joined: Thu Oct 17, 2013 9:26 pm
Contact:

About Question enthuware.oce-jpad.v6.2.513 :

Post by ericrlessa » Mon Oct 28, 2013 7:52 pm

RESOURCE_LOCAL transaction-type can be only used in Application-managed Entity Manager? In this question, the Statefull Session Bean should use Application-managed Entity Manager?

admin
Site Admin
Posts: 8621
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.513 :

Post by admin » Sat Nov 02, 2013 7:43 am

I am not sure I understand your question. In this question, em could be injected also. It doesn't have to be RESOURCE_LOCAL.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

ioan.b
Posts: 3
Joined: Sun Nov 30, 2014 5:00 am
Contact:

Re: About Question enthuware.oce-jpad.v6.2.513 :

Post by ioan.b » Sun Nov 30, 2014 5:08 am

em.getTransaction() will throw IllegalStateException if invoked on a JTA entity manager.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.513 :

Post by johnlong » Sat Dec 24, 2016 5:59 pm

Code: Select all

1. EntityTransaction et = em.getTransaction();
2. et.setRollbackOnly(); 
Could you please describe case(s) in which et instance would be non-active transaction on line 2?

admin
Site Admin
Posts: 8621
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.513 :

Post by admin » Sun Dec 25, 2016 12:22 pm

What if processAccount is the first method to be invoked. In the given code, there is no call to begin. Thus the transaction is not active at this point and therefore a call to setRollBackOnly will throw IllegalStateException.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.513 :

Post by johnlong » Sun Dec 25, 2016 6:20 pm

I see now, transaction is not active because begin has not been called, thank you.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest