• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple Instance of Beans Created for same PK  RSS feed

Ashutosh Shinde
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are facing this peculiar problem while running our EJB's :
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.

FYI, we are running the EJB's on Weblogic5.1. Oracle is the db used.

Any comments would be appreciated.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!