This depends on a number of factors.
- What commit option (from the
EJB 1.1 spec) are you using? If you are using the equivalent of commit
option A, you are telling the app server that the entity bean is the sole
component updating the database, so ejbLoads() can be suppressed. How
exactly you specify the commit option is app server-dependent.
- What transaction attribute is
on the method(s) used to retrieve the entity' data? Is it REQUIRED
or REQUIRES NEW, to insure a transaction is being used? Transactions drive
the ejbLoad() and ejbStore() call backs.
- What transaction isolation
level are you using?
Laurel
-----Original Message-----
From: Kumar, David
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday,
April 10, 2002 3:36 AM
To: [EMAIL PROTECTED]
Subject: Re: Java: Entity Beans
not synchronising with database
We are using a finder
method in the home interface of the entity bean to retrieve the entity beans
mapped over the records that we have previously updated using the direct update
from a stateless session bean.
I understand that the
entity beans are being retrieved from the pool, but why are they not
synchronised with the changes made to the database?
-----Original
Message-----
From: Duncan Alexander
[mailto:[EMAIL PROTECTED]]
Sent: 09 April 2002 20:58
To: 'Kumar, David';
[EMAIL PROTECTED]
Subject: RE: [EJB-INT] Java:
Entity Beans not synchronising with database
Hi David,
Are
you using EJB 1.1 or EJB2.0, home methods don't exist in EJB1.1.
If
its EJB2.0 then...You say on the one hand that you are using an entity
'home' method to retrieve the data that has just been entered in
the previous transaction, but on the other hand you say that the entity bean
you 'created' does not reflect the data in the DB. Calling an
entity home method does not imply the creation of an entity bean only the
temporary use of a bean from the free pool. If your home method is only
accessing the variables of the entity you cannot depend on the synchronisation
with the DB which happens when creating and accessing a bean directly.
>9.5.4
home methods
>An entity bean's remote home interface may
define one or more home methods. Home methods are
>methods that the bean provider supplies for
business logic that is not specific
to an entity bean instance.
regards
DGA
-----Original Message-----
From: A mailing list for
Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]] On Behalf Of Kumar, David
Sent: 09 April 2002 09:37
To: [EMAIL PROTECTED]
Subject: [EJB-INT] Java: Entity
Beans not synchronising with database
We are currently using a stateless
session bean to perform a direct update of a table in the database and then
using the home method of an entity bean which is mapped over the same table to
retrieve the records that have just been updated. Because both transactions are
managed by the application server, it should know that
the entity bean needs to refresh from the database because some
data has changed.
However the result is that the
direct update is committing the change to the database as you would expect, but
the entity bean does not reflect that change when it
is created. Do we need to force the entity bean to refresh
from the database?
We are using 1.5.4 Orion Application
Server, EJB 1.1 and MSSQL 7 database.
|