Sachin Aggarwal wrote:
>> I think this is a pretty simple issue and when I brought it up with our ejb
>> server vendor( weblogic) - I was told they were fixing it. Now they have a
>> delay_update property that can be set to false and then the database will be
>> in synch with the memory all the time .
>> I don't like the solution of hitting the database for every settor and was
>> hoping to find a better solution.
Chip Wilson replied:
>There can be no other solution, since the entity beans may use bean-managed
>persistence. To provide the behavior requested of the finder method, the
>container will have to call ejbStore after any entity bean method is invoked,
>possibly many times on the same bean instance within the same transaction. This
>will end up executing multiple SQL update statements on the same records within
>the same database transaction.
I don't think the container has to keep the database with the memory ALL the time.
Only the finder methods look up the database directly bypassing all changes in memory.
It is sufficient to synchronize with the database before executing the SQL-query in a
finder method. There is no need to do this after every setter method. If you're using
a finder method in the "proper way" with "good" application design, this would
probably often be at the beginning of a transaction.
In this case there would be no "dirty" entity beans envolved in the current
transaction and there would be only a minimal performance loss.
Another solution would be to make a synchronize method available to the
bean provider. In this case the bean provider would be responsible to enforce
synchronization whenever needed. This solution would give greater flexibility, because
it would allow to achieve synchronization not only in finder methods, but for example
in session beans with direct JDBC-code for pure data reading bypassing the
instantiation of entity beans. And if an application in designed in a way, that no
extra synchronization is needed, there would be no loss at all.
I suggest to change the specification as to this point.
Dirk.
===========================================================================
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".