Hi
Ashutosh,
The
behavior you described is strange, especially under WL 5.1, which only
implements pessimistic entity bean locking. Only one bean instance of a PK
should be instantiated per container; hence I would suggest you take a
look at how you implemented PK.hashcode() and PK.equals()... perhaps you
want to post them here.
Another thing you can try is to call findByPK() +
EB1.methodEB1() twice within SSB1.methodSB1() and see if you get the
same behavior.
Gene Chuang
Kiko.com
Kiko.com
-----Original Message-----
From: Ashutosh [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 6:44 PM
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" <[EMAIL PROTECTED]>Sent: Monday, September 10, 2001 5:32 AMSubject: 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: [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 [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".
>
