You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by hu bo <je...@gmail.com> on 2007/11/09 01:04:32 UTC

Can I call userTransaction.begin in on sessionbean method, and call userTransaction.commit in another sessionbean method?

Hi,

In Bean managed transaction, can I call userTransaction.begin in on
sessionbean method, and call userTransaction.commit in another sessionbean
method?
Is there any difference between stateful and stateless session bean about
this?

Thanks,

Re: Can I call userTransaction.begin in on sessionbean method, and call userTransaction.commit in another sessionbean method?

Posted by David Jencks <da...@yahoo.com>.
On Nov 8, 2007, at 4:04 PM, hu bo wrote:

> Hi,
>
> In Bean managed transaction, can I call userTransaction.begin in on  
> sessionbean method, and call userTransaction.commit in another  
> sessionbean method?
Yes, if it is a Stateful Session bean and you are using the same  
instance for both calls.
> Is there any difference between stateful and stateless session bean  
> about this?
Yes, it only works with  stateful session beans and you have to be  
careful to use the same instance for all calls in the transaction.
With stateless session beans a transaction you start in a method must  
be completed before the method returns.  With stateless session beans  
there is no concept of "same instance" between calls.

david jencks

>
> Thanks,