(Im using Bean Managed Persistence)

I noticed that examples from my vendor, and a couple of books I have
read show examples of BMP Entity beans that look like:

ejbFindByPrimaryKey(MyPK aPK)
{
    refresh(aPK);
}

refresh(pk)
{
  select * from table x
  load all the data into the instance
}

lets also assume I have a method:
ejbLoad()
{
 refresh(pk)
}

What I observe happening in my container when a client calls findByX is:

findByX()
refresh()
ejbActivate()

but before I can call another method on the bean, the container calls:
ejbLoad() (which then calls refresh() )

So I in effect get 2 selects for the client method call:

clientCall
{
myBean = home.findByX("foo");
myBean.doSomething();
}

This seems very inefficient. I think if I wrap the whole call in a
transaction then It would make me only have 1 select. But I dont want a
transaction for read only stuff.

I guess the main comment is there is a way to tell the container you
know better on a save by using a dirty flag, but there doesnt seem to be
a way to do this with the load.

I would really like to say, hey if this is all coming from one client
context, then dont call load on each call (even if im not in a
transaction).

any ideas on how to do this the most efficient way?

thanks
Joel

===========================================================================
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