You code is illegally written. The following edit will accomplish what you
want.

> public class FooBean extends SessionBean 
> {
>       
>       /**
>        * @ejb:create-method
>        */
>       public void ejbCreate() 
>       {
>       }
> 
> 
>       /**
>        * @ejb:remote-method  // do you mean a 'Business Method' that a Foo
client calls?
>        */
>       public void foo() 
>       {
>               // do something interesting
>               bar();
>               // do something interesting
>       }
> 
>       
>       /**
>        * @ejb:remote-method  // does a Foo client call this method?
>        */
>       public void bar() 
>       {
>               // do something interesting
>       }       
> }

If foo() is under a transaction then calling bar() from foo() puts bar()
under the same tranaction. 

The question becomes does bar() really need to be public? Is bar() called by
the Foo client directly?

Dave

-----Original Message-----
From: Juan Lorandi (Chile) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 10:51 AM
To: Orion-Interest
Subject: RE: Invoke a method on myself in a Stateful Session Bean.


Neat. I've been having similar problems trying to execute a findByPrimaryKey
in the ejbCreate method of a bean. Errors, however, just come and go away
randomly.

> -----Original Message-----
> From: Mikael Ståldal [mailto:[EMAIL PROTECTED]]
> Sent: Miércoles, 22 de Agosto de 2001 3:34
> To: Orion-Interest
> Subject: Invoke a method on myself in a Stateful Session Bean.
> 
> 
> When I try to do like the code below, I get this error:
> 
> com.evermind[Orion/1.5.2 (build 
> 10460)].server.rmi.OrionRemoteException:
> Recursive call to non-reentrant bean
> 
> Is there any other way to do this? I don't want to invoke the methods
> directly, since I want to make use of container managed transactions.
> 
> 
> /**
>  * @ejb:ejb-name Foo
>  * @ejb:stateful-session
>  */
> public class FooBean extends SessionBean 
> {
>       private Foo me;
>       
>       /**
>        * @ejb:create-method
>        */
>       public void ejbCreate() 
>       {
>               me = (Foo)PortableRemoteObject.narrow(
>                       sessionContext.getEJBObject(),
> Foo.class);
>       }
> 
> 
>       /**
>        * @ejb:remote-method
>        */
>       public void foo() 
>       {
>               // do something interesting
>               me.bar();
>               // do something interesting
>       }
> 
>       
>       /**
>        * @ejb:remote-method
>        */
>       public void bar() 
>       {
>               // do something interesting
>       }       
> }
> 

Reply via email to