• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
Did you miss me? Did you miss this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic