Entity beans store their data automatically after you call set methods. For
example, if I have a customer bean and I call setFirstName(), the container
will automatically store the new data in the database. If the bean is
configured for bean managed persistence then the container will call the
bean's ejbStore() method which must then update the database.  If the bean
is configured for container managed persistence then the container will
automatically update the database.  I believe that the ejbStore() method
will still be called but it does not have to do anything.

The container will also call ejbLoad() whenever it needs to so that the bean
can get the latest data from the database.  The container is responsible for
calling ejbStore() and ejbLoad() at the right times.

You never need to call remove on an entity bean unless you really intend to
delete the record that the bean represents.

-----Original Message-----
From: Nimmons, Buster [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 11:34 AM
To: JRun-Talk
Subject: Placing entinty bean data back in storage


> After recently completing my first Entity bean assignment in which I
> called home.create() to create a data object both in my database and in
> the entity bean, I noticed that at the end of the lesson we had to call
> home.remove() which not only removed the data from the in-memory entity
> bean but also from the database. According to my experience removing
> database data is not done nearly as often as creating data. However on an
> EJB home object there is no save() method or anything like that. Are we
> simply to rely on the EJB container to call the EJBs store method whenever
> it deems it necessary. How do we assure that changes made to entity bean
> data gets saved to the database.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to