• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB2 transaction attributes

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic