Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB2 transaction attributes  RSS feed

 
koen ja
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a stateless session bean where all methods have "RequiresNew" transaction attribute.
That's what I want since all methods have to be transactional.

Now I have a method A on this session bean, wich has to call a method B.
But this method B should be executed outside of A's transaction.


So, my idea was to add the method B on the session bean with transaction attribute "NotSupported".
So A would be executed in a transaction. And when A calls method B on the session bean, B would be executed outside of the transaction of A.


However I get a com.ibm.ws.exception.WsEJBException when trying to execute this method B.


Any ideas?

Thanks,
Koen
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Now I have a method A on this session bean, wich has to call a method B.
But this method B should be executed outside of A's transaction

Why? If method B is part of the business logic for Method A then I can't think why you would want the transaction in B to succede if the method A fails?

You can't do what you want without two seperate EJB calls, otherwise if method A requires a new transaction, and it calls method B, then method B will always use the same transaction as method A.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A NotSupported transaction attribute type is, in theory, no reason for throwing an exception. Maybe something else is going on here? Can you post the code and the exception stack trace?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!