The EJB 1.1 specification did not require that data
changed in an entity bean be flushed before a finder method runs against
the entity bean. Therefore, in WebSphere Application Server V4 and V5,
when EJB 1.1 entity beans are used, entity bean data is not persisted to
the database until the transaction is committed.
The EJB 2.0 specification, section 10.5.3 Container's
view, however, states the following:
The Container is responsible for ensuring that updates to the
states of all entity beans in the same transaction context as the
ejbFind<METHOD> method are visible in the results of the
ejbFind<METHOD> method. Before invoking the
ejbFind<METHOD>(...) method, the container must therefore
first synchronize the state of any entity bean instances that are
participating in the same transaction context as is used to execute the
ejbFind<METHOD>(...) by invoking the ejbStore() method on those
entity bean instances.
Therefore, in WebSphere Application Server V5, when EJB 2.0 entity
beans are used, the pre-find flush mechanism is used, and entity bean data
is persisted to the database just before a finder method is run.
|