Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Bean TX

 
Manish Katyan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For stateful Session Bean
- You can access resource manager, other beans from ejbCreate(), ejbRemove(), ejbActivate(), ejbPassivate()
- Methods ejbCreate(), ejbRemove(), ejbActivate(), ejbPassivate() runs in 'unspecified transaction context'

Now tell me, how can you access other beans / resource managers from 'unspecified transacrtion context' - i think they can be accessed only from transactional context.

Am i missing something? Please give your input.


Thanks.

Katyan.
 
David McDonagh
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what the specs mention on this subject P364

====================================================================
The EJB specification does not prescribe how the Container should manage the execution of a method with an unspecified transaction context´┐Żthe transaction semantics are left to the Container implementation.
====================================================================

so to answer your question accessing other beans / resource managers is left solely to the implementation of the container. The specs give some examples of possible solutions .......

=====================================================================
->The Container may execute the method and access the underlying resource managers without a transaction context.
->The Container may treat each call of an instance to a resource manager as a single transaction (e.g. the Container may set the auto-commit option on a JDBC connection).
->The Container may merge multiple calls of an instance to a resource manager into a single transaction.
->The Container may merge multiple calls of an instance to multiple resource managers into a single transaction.
->If an instance invokes methods on other enterprise beans, and the invoked methods are also designated to run with an unspecified transaction context, the Container may merge the resource manager calls from the multiple instances into a single transaction.
->Any combination of the above.
=====================================================================

I hope this helps !!
 
Manish Katyan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, David.

Sometimes it really gets confusing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic