hey!
 
I suppose a bean is associated with only one EJBObject at one instance
and not more than one.
So once SSB1 has fired a findBy method a bean will be associated with
the EJBObject and the
SSB1 will get the remoteInterface to work with.
 
And when SSB2 goes for findBy again, it won't be able to work on the
same EB but will get the new
bean associated with an EJBObject and will get a remoteInterface to work
with.
 
After all if one bean will be associated with more than one EJBObject at
the same time then there will obviuously be threading
issues which infact is avoided by the Entity beans by introducing
various call backs and life cycle methods.
Ya ! if you consider the pooled and free states of the bean then, one
bean does get associated with different
EJBObjects but still at one point of time with only one EJBObject.
 
Hence the constructor is called while you find again for the same data
in SSB2.
 
correct me if I'm wrong.
 
n-joy,
Nikhil.

-----Original Message-----
From: Ashutosh [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 11, 2001 7:14 AM
To: [EMAIL PROTECTED]
Subject: Re: Multiple instance of Beans created (Finder problem)


hi Jay,
         Reading my mail again i  realised that i had written the part
you are mentioning terribly ! Sorry for that.
I will try to explain  again-
 
SSB1 has a method in txn attribute "Required".
In this method SSB1  calls findByPrimaryKey() on EB1.
It then call MethodEB1() on EB1 remote reference.
Then, SSB1 calls MethodSB1() on SSB2 and passes the same Primary Key
attributes to this method. This method is also in txn attribute
"Required". 
MethodSB1() of SSB2 calls findByPrimaryKey() with the attributes passed
to it by SSB1. I understand that we could have passed the entity bean
reference to this method and used it.However, it was this very slippage
that led us to the problem we are currently facing.
When SSB2 calls the finder method we see the constructor of the bean
being called. 
On getting the reference to the bean, SSB2 calls MethodEB2() on the
Entity Bean.
On this call ejbLoad() is not being called. 
I assume that it is not being called becase the whole sequence is being
executed in a single transaction (required) and that ejbLoad() has
already been called once for this instance when SSB1 gave a call to
MethodEB1(). 
However, because a new instance is created (i dont know why!) ejbLoad
should have been called. 
Also, once a PK object has been associated with a bean and the bean has
been associated with one or more EJBObjects i fail to understand why
another instance is created by the container. 
 
Comments??
 
Ashutosh
 
----- Original Message ----- 
From: "Jay Walters" <  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED]>
To: <     <mailto:[EMAIL PROTECTED]> >
Sent: Monday, September 10, 2001 5:32 AM
Subject: Re: Multiple instance of Beans created (Finder problem)

> I don't get the part about running in TX_REQUIRED not calling ejbLoad.
The
> shared flag (or whatever in Weblogic) is really what should impact
ejbLoad
> or not, but if it's using a new bean it has to call ejbLoad at least
once.
> Do you know that the container is trying to execute the business
method on
> the second bean for a fact, or could the first bean somehow be the one
being
> called but it's internal state has not been set correctly?
> 
> Cheers
> 
> -----Original Message-----
> From: Ashutosh
> To:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
> Sent: 9/10/01 1:19 PM
> Subject: Multiple instance of Beans created (Finder problem)
> 
> hi everyone,
> 
> 
> 
>  We have 3 beans , 2 of them are Stateless Session Beans and the third
> is
>  a Entity bean (using Bean managed persistence). All method in the
> Entity
>  bean run in Supports txn scope.
> 
> 
> 
>  The SSB 1 has a method in Required Txn scope in the Remote Interface
> 
>  which looks for a specific row in the db using the Entity Beans
> 
>  findByPrimary key method.
> 
> 
> 
>  The SSB 1 then calls a biz. method on the entity bean. It then passes
> on
>  the primary key atrributes to the SSB 2 method ( Required Txn scope
> again
>  ) which does a findByPrimary key on the Entity Beans ( basically
looks
> up
>  for the same row ) and calls a biz method in the Entity Bean.
> 
> 
> 
>  The problem we are facing is,
> 
> 
> 
>  When SSB2 calls the findByPrimaryKey method on the Entity bean a new
> Bean
>  instance is created ( the constructor of the Bean is called ) and the
> 
>  subsequent call to the biz method does not call the ejbLoad ( as it
is
> 
>  running in Required Txn scope. ) and as the attributes of the bean
are
> 
>  populated in the ejbLoad the biz method execution fails.
> Since, we are refering to the same row in the table our understanding
is
> that another instance need not be created.However, the call to the
> constructor defies our inderstanding.
> 
> 
> We understand that passing the reference of the entity bean to the
from
> SSB1 to SSB2 would solve our problem. But, the behaviour exhibited
> confuses us.
> 
> FYI, we are running EJB1.1 on Weblogic 5.1 with SP9.
> 
> Any pointers on the problem will be highly appreciated.
> 
> 
> Thanks,
> Ashutosh.
> 
>
========================================================================
===
> To unsubscribe, send email to  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email
to
>  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] and include in
the body of the message "help".
> 

==========================================================================To 
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to