I asume that the two statements execute within a container managed
transaction.

Some containers are implemented along with the recommendation (or scenario)
of the spec, namely to defere database updates until the end of the
container transaction. In that scenario, you will have an inconsistency
between the state of your modified entity bean instances and the outcome of
entity bean finders (as well as JDBC calls) that depends on the value of the
underlying database columns. If you replace your second statement with a
statement that uses a finder to find all order items with price equal to
100.00, your orderItem will not be among them - at least not using the
containers I have been working with.

I think there was an addition in the EJB2.0 spec between public draft 1 and
final draft, that added a scenario about EJB QL implementation should take
insaved state into consideration, when processing queries.

/Johan

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Heiko Gottschling
Sent: 05 January 2001 12:34
To: [EMAIL PROTECTED]
Subject: Entity Bean / database synchronization issues


Hi,

as I understand the specification, it is up to the container to synchronize
existing entity bean instances with the DB, i.e. the bean developer must not
make any assumptions as to when the ejbStore() / ejbLoad() methods are
called.

If this is the case, how is consistency preserved if the tables associated
with the enitity bean is accessed "behind the bean's back"? Imagine
something
like this:

  orderItem.setPrice(100.00);
  statement.execute("SELECT SUM(price) FROM OrderItem WHERE OrderID=1234");

Here the price column of an OrderItem record (represented by an entity bean)
is updated and the table is queried immediately after. For this to work, the
entity bean must have been written to the database before the execution of
the SELECT statement. How is data integrity guaranteed in this case?

thx
Heiko

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