You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Christoph Weiss <ch...@de.ibm.com> on 2014/07/31 20:53:57 UTC

Fw: How to Trace the used Transaction from the EntityManager

Dear User Group,

I am using OpenJPA in combination with WebSphere 8 within a customer 
project. 
In the project we are using multiple Stateless EJB and typically we are 
calling multiple EJBs for a piece of business logic. 
Each EJB is performing some JPA actions (database read / update).

Now we want to make sure that a "piece of business logic" is running one 
transaction. 
For this we are using the @TransactionAttribute REQUIRED annotation. 

However taking a look at the EJBs (during the debugging) we see that each 
EJB seems to work with an own EntityManager (at least based on the object 
id).
So we are not sure if the "business logic is really carried out at one 
piece". 

Thus following questions: 
1.) Is there any way to trace / log the Transaction that is used by the 
EntityManager (at the end of the day) ? 

We activated the openjpa.jdbc,SQL Trace and see the following log 
statement: 
[29.07.14 10:17:34:692 CEST] 000000db jdbc_SQL      3   openjpa.jdbc.SQL: 
Trace: <t 1902712361, conn -1754159499> executing prepstmnt -341855657

Is "t 1902712361" the transaction used? (or is this just another 
identifier in the SQL context) 

2.) Is there any trace providing further information? 

3.) Is it the "expected behaviour" to have different EntityManager for 
each EJB (well they might be coordinated by the EJB container .... )? 
(EntityManager is created by injection, using @PersitenceContext

Any feedback would be appreciated.
Thanks in advance.

Cheers Christoph Weiss