File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to identify existing Transaction?

 
Patrio Jensen
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created 2 SLSB say ParentBean and ChildBean. I am calling ChildBean from within ParentBean.

I am using CMT for both beans and have specified Required transaction attribute for both the beans.

My question is: How can I know whether container has created new transaction for the ChildBean or it's using that of ParentBean?

I tried printing hashcode for UserTransaction inside both beans but I am getting different values.

Thanks in advance.
 
Patrio Jensen
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mistake: I was getting UserTransaction using jndi lookup and not using EJBContext.getUserTransaction() call hence getting different values.

But now when I used getUserTransaction() method, I am getting error: Only instances of beans with bean-managed transaction demarcation can use getUserTransaction()

I realized that calling getUserTransaction() is not allowed for CMT beans as mentioned here

But still my question remains open.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic