Exactly.

ejbStore must be called at the end of the transaction, even for CMP. The
CMP may not store anything to the database if it detected no changes,
but must still make the method call to the bean.

arkin

Dan OConnor wrote:
>
> The method ejbStore is always going to be called at the end of a
> transaction on a bean (and it may be called at other times as well).
> This is necessary to comply to the specification. My earlier e-mail,
> by the way, should have read that ejbStore happens typically, but
> not EXCLUSIVELY, on transaction boundaries.  It will always be
> called at the end of a transaction.  (See, for example, 9.1.1.0:
> Commit options in the specification.)
>
> The relevant question is whether the ejbStore call is updating
> resources.  An ejb container can determine that the bean's state
> did not change during a transaction, and therefore not update the
> resources, in the case of container-managed persistence.  The
> bean programmer (or object-relational mapping vendor) is
> responsible for making this determination in the case of bean-
> managed persistence.
>
> The println should always be called in Dave's example.  If he is
> using container-managed persistence and the database is being
> written after using his "gentile" function, it seems to me there is an
> opportunity for improvement--either by reconfiguring his existing
> application server, or changing servers.  If he is using bean-
> managed persistence, he probably wants to keep track of state
> modifications in his bean so that ejbStore can behave intelligently.
>
> -Dan
>
> On 9 Apr 00, at 17:33, Charlie Alfred wrote:
>
> > Could be that the number of entity beans returned by the
> > finder is larger than the cache size configured for your
> > EJB Server.  As you iterate through the collection returned,
> > your server may be passivating (swapping out) beans to make
> > room.
> >
> > Charlie
> >
> > > -----Original Message-----
> > > From: DaveFord [mailto:[EMAIL PROTECTED]]
> > > Sent: Sunday, April 09, 2000 1:42 AM
> > > Subject: Unneeded calls to ejbStore
> > >
> > >
> > > 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
> > >
> >
> > ===========================================================================
> > 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".
> >
>
> ===========================================================================
> 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".

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