This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Question for CMT Session Bean

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In spec (P78):
--------------------------------------------------------------------------
An error occurs if a client attempts to invoke a method on the session object and the deployment descriptor for the method requires that the container invoke the method in a different transaction context than the one with which the instance is currently associated or in an unspecified transaction context.
---------------------------------------------------------------------------

I just don't understand how can this happen?

From the spec, this is talking about CMT session bean and container serialize the request to the bean, so that means a method can not be invoked by the client in the middle of another method, if one method finish, the related transaction will be commit or rollback(tx cannot span multiple methods for CMT), new method may create a new transaction(if it needs tx) and starts its own life cycle ..., so from my point of view, each method call from the client is an independent cycle, I can't understand what scenario the above spec is talking about

Any Suggestion is appreciated
 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
2 situations:

1. client calls with its own txn

The called SFSB CMT method is 'Required' and inherited the client's tx and hence the method will not commit at end of method call.

And, now the client calls the same SFSB but another 'RequiresNew' method. A new txn context has to be created. Which is not allowed.

2. called bean methods call another bean method

If the "another bean method" is marked as "RequiresNew", a new txn context also has to be created but is illegal for sfsb.
 
Jason Hunt
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Alec:

your first situation answer my question, but for your second situation, it is legal situation. because if the method call other method with RequiresNew attribute, then the original transaction will be suspended, so at the same time, there won't be two tx at a time.

thanks again
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic