Hello.
Why does my Entity EJB call ejbLoad()/ejbStore() lots of times (say 16 or around) each time I call one bean's bussines method?
This is my scenario:
public class MyBean extends EntityBean {
BigDecimal pk;
String aText;
MyBeanA beanA;
MyBeanB beanB;
...
public void ejbLoad() {
...
this.aText = aResultSet.getString(1);
this.beanA = beanAHome.findByPrimaryKey(pk);
this.beanB = beanBHome.findByPrimaryKey(pk);
...
}
public int getValFromBeanA() {
return beanA.getTheVal();
}
}
I use Sun's j2eesdk1.2.1 reference implementation as developing plattform.
MyBean acts as MyBeanA and MyBeanB client. When I call getValFromBeanA method, this causes lots of ejbLoad()/ejbStore() calls. Is that a Sun's bug or is there an explanation?
Also I get a RemoteException when executing beanA.getTheVal(). I tryed using both 'Required' and 'Supports' for Transactions.
I am planning moving to iPlanet as my developing plattform. Is this worthy? I decided using the Sun's RI 'cause I found it enought and cheap ;-)
I really thank any idea.
Cheers:
J. Carlos Muro
Discussions
EJB programming & troubleshooting: MyBean calls ejbLoad()/ejbStore() under a bussines method call
-
MyBean calls ejbLoad()/ejbStore() under a bussines method call (2 messages)
- Posted by: Juan Carlos Muro
- Posted on: May 09 2002 16:00 EDT
Threaded Messages (2)
- MyBean calls ejbLoad()/ejbStore() under a bussines method call by anil lewis on May 14 2002 12:20 EDT
- MyBean calls ejbLoad()/ejbStore() under a bussines method call by Ken Norcross on May 14 2002 14:18 EDT
-
MyBean calls ejbLoad()/ejbStore() under a bussines method call[ Go to top ]
- Posted by: anil lewis
- Posted on: May 14 2002 12:20 EDT
- in response to Juan Carlos Muro
Hi,
The server is probably using Option C for Commit options.Here whenever a method is called a select SQL is fired and all the instance fields are populated.Once the transaction is completed,ejbStore() is called.If u do not want this try Option A.In this EJB has exclusive rights on the DB.U must ensure that no other application is updating the DB
Bye -
MyBean calls ejbLoad()/ejbStore() under a bussines method call[ Go to top ]
- Posted by: Ken Norcross
- Posted on: May 14 2002 14:18 EDT
- in response to Juan Carlos Muro
Where is the transaction boundary?
If all of your calls are made within a single transaction, then there will be only one store at the end of the transaction.
If a transaction is started every time you run an entity bean method, then there will be a store after each method call.
You have to understand what the transaction boundaries are in order to control how many stores you do.