Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EjbContext invocation  RSS feed

 
Alana Sparx
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!