A similar problem occurs if an entity bean is updated by some business
method and a finder method is invocated in the same transaction.
For example: You have a person (entity bean) with pk = 100 (personNumber)
and name = "Simpson". You do a person.setName("Smith"). In the same
transaction there is an invocation of findByName("Smith"). Will our
person with pk = 100 be in the result? I think this is not specified.
I can't find something in the spec about it. If a container simply executes
the finder method, this would look up the database and person No 100
wouldn't
be found. By the way: a findByName("Simpson") would find Mr. Smith!!!
But coincidentally the container could have passivated the bean. In this
case
there would have been done an ejbStore() and the findByName("Smith") would
correctly find person No 100. The result of the find method is dependent of
a possible passivation has occured or not!
Shouldn't the container synchronize the state of all entity beans involved
in the current transaction before executing a finder method to avoid these
problems?
Dirk.
Dirk Willecke, Datenzentrale Schleswig-Holstein
Tel. ++49 431 3295-860 / Fax ++49 431 3295-510
http://www.landsh.de/dzsh/
-----Urspr�ngliche Nachricht-----
Von: Sachin Aggarwal [mailto:[EMAIL PROTECTED]]
Gesendet am: Freitag, 8. Oktober 1999 00:39
An: [EMAIL PROTECTED]
Betreff: finder methods specifications
Shouldn't the finder methods that use non key attributes for search look in
the memory if the entity was not found in the database .
This ofcourse is relevant only in the case where the entity was created in
the same transaction as the finder method invocation.
I know this is tricky because this would require the container would have to
do an sql kind of search in the memory based on the attributes of new
created or newly updated entities.
Is this a requirement as per the spec ?
This seems to be a serious issue. If a method just added a new item to the
shopping cart and wants to get all the items using a finder, then the new
item needs to be retrieved by the finder so the total cost is correct?
How is everybody solving the problem of new entities that have not been
persisted in the database ?
Sachin.
p.s - the solution of updating the database on every update/insert or
passing all the information along from one method to another does not seem
viable.
===========================================================================
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".