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