File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes Multiple Instance of Beans Created for same PK Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Reply Bookmark "Multiple Instance of Beans Created for same PK" Watch "Multiple Instance of Beans Created for same PK" New topic
Author

Multiple Instance of Beans Created for same PK

Ashutosh Shinde
Ranch Hand

Joined: Jun 07, 2001
Posts: 42
I am running EJB1.1 on Weblogic 5.1 . I am facing the following problem. I am not sure whether this is specific to Weblogic or EJB's but if someone can provide any pointers it would definitely help.
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??
 
 
subject: Multiple Instance of Beans Created for same PK
 
Threads others viewed
BMT txn propagation to CMT
Multiple Instance of Beans Created for same PK
when ObjectNotFoundException happens? when NoSuchEntityException happens?
Question for CMT Session Bean
My SCEA Part 1Study Notes
developer file tools