Hi,

this i did not know. So, the EJB spec wants to ensure that even if the
database is changed from outside the EJB server, that the beans are up to
date ? Well, it's a very nice Feature in some circumstances - but in some
circumstances (if i am sure, that nobody from outside will ever change the
DB) it is a great slow down. I always thought of the EJB Server as a kind of
cache between the client and the database (ok, not only a cache...). Even if
the spec requires this behaviour, what about an additional configuration
option for an entitre application (or even for each bean ?) to tell the EJB
server that he is the only one to access the DB and therefore can ommit a
lot of calls to ejbLoad (that ejbStore is neccessary after each transaction
is clear, in this case the bean must decide, if it's been changed).

Just a wish...

Jens Stutte



-----Urspr�ngliche Nachricht-----
Von: Andy Grove [mailto:[EMAIL PROTECTED]]
Gesendet am: Sonntag, 9. April 2000 12:09
An: Orion-Interest
Betreff: Re: Unneeded calls to ejbStore


Dave,

The container must use ejbLoad() at the start of a transaction to
synchronize the beans
state with that of the database and must also call ejbStore() at the end of
a transaction
to update the database with any state changes. This is essential for
spec-compliance.

Of course, if no data has actually been changed then there is no reason why
the call to
ejbStore() has to actually do anything - it can just return. Many people
choose to have
a boolean isModified attribute in their entity beans for this reason.

Regards,

Andy Grove




>The following block of code generates a customer pick list. It only READS
>from the database and does NOT WRITE to the database. However, I have added
>a println to CompanyBean's ejbStore method and it reports that ejbStore is
>being called five times (once for each time through the while loop). Why is
>ejbStore being called?
>
>Iterator it = companyHome.findByName("Wal").iterator();
>while(it.hasNext()){
>  Company comp = (Company)it.next();
>  System.out.println( comp.gentile() );
>}
>
>Thanks,
>
>Dave Ford



Reply via email to