• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why findByPrimaryKey(...) is calling ejbActivate?

 
Arun Kandregula
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
For a CMP bean, when I tried to execute findByPrimaryKey(String), I see that
ejbActivate
ejbLoad
ejbStore

all three are being called.

Piece of code:

IBooksHome bh = (IBooksHome)PortableRemoteObject.narrow(home,arun.entity.booksCMR.IBooksHome.class);
IBooks book = bh.findByPrimaryKey("10001");

When I called home bussiness method...neither of those 3 are called , which is expected.
I know that finder methods, home bussiness methods are called on instances in the pool. Then ***WHY*** the instance is getting activated and being assigned to the EJBObject when I called findByPrimaryKey. WHY THOSE 3 METHODS ARE CALLED.

Please help me out .
Thanks in advance.
Arun.
 
Makesh Kumar Ramakrishnan
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you invoke findByPrimaryKey(String), it returns the entity bean instance of that primary key.. If the entity bean is passivated, then first it activates it , then loads the instance with the data. Please correct me if i am wrong..

Makesh
 
Makesh Kumar Ramakrishnan
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you invoke findByPrimaryKey(String), it returns the entity bean instance of that primary key.. If the entity bean is passivated, then first it activates it , then loads the instance with the data. Please correct me if i am wrong..

Makesh
 
paresh vernekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Mahesh,
I think the instance is not loaded with data when a findByPrimaryKey finishes execution.This is because the client may or may not invoke a business method after the findByPrimaryKey, hence there is no point in going for the database access.If the client choses to invoke the business method, then the container will necessarily have to load the data into the bean instance.


Regards,
Paresh Vernekar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic