Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

If my session bean with single method insert record into 2 entity beans, how can know that the process is done in same transaction (the attributes for these beans are Required)?

0
Posted

If my session bean with single method insert record into 2 entity beans, how can know that the process is done in same transaction (the attributes for these beans are Required)?

0

If your session bean is using bean-managed transactions, you can ensure that the calls are handled in the same transaction by : javax.transaction.UserTransaction tran= null; try{ tran=ctx.getUserTransaction(); tran.begin(); myBeanHome1.create(….); myBeanHome2.create(…); tran.commit(); }catch(…){} You may want to check if you’re already running in a transaction by calling tran.getStatus().

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123