Win a copy of Head First Android this week in the Android forum!
  • 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

EjbContext invocation

Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This is related to my earlier thread on rolling back transactions.

I want to set a transction for rollback using the setRollbackOnly() method of EjbContext.

I don't want to do this inside the session bean, I would rather do this inside the service called by the seesion bean.

My question is in this service, can i make a JNDI call to get the EjbContext? The syntax will be something like:

What is the value of 'jndiString'. I'm finding WebSphere most unhelpful with discovering these bindings.

Many thanks.
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the session bean method is enlisted in the same transaction as the client's then you can just get a reference to the UserTransaction and roll it back yourself. I'm not familiar with the possibility of passing around the SessionContext so anybody can roll back it's transaction. It probably violates some container rules. If you want a client to have control over the session's transaction, make it part of the same transaction and have the client use the UserTransaction. That's what it's there for.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic