Enrico,

On Tue, 27 Jan 2004 09:34:48 +0100, Stein M. Hugubakken wrote:

>[EMAIL PROTECTED] wrote:
>> Hi, 
>> 
>> I want to run castor in a servlet environment.
>> 
>> i load (ReadOnly) an object, store it as a 
>> servlet session attribute. 

I am not sure whether this will work at all. If you are loading the object instance(s) 
really in READ_ONLY mode (using this very access mode), Castor will 
not support long transactions for these objects as Castor does not keep the relevant 
timestamp data in its caches for read-only classes. Do you really have 
a need to load them in read-only mode ?

>> I guess i can (in the 
>> same session, but in another request) get back the 
>> reference of that session attribute, modify it and
>> update it (long transaction, right?). 
>> what happens next, (still in the same session, but on 
>> another request) if the object gets modified and updated 
>> again? Will it be still synchronized with the database, or
>> does the long transaction only works on the two first transactions?
>> 
>
>It will be in sync with the database.
>
>Note that you must reload the object if some other instance of the same 
>object is modified.

This scenario will be indicated to you through the means of an 
ObjectModifiedException, basically telling you that another thread has modified the 
underlying object in the meantime. Just follow Stein's suggestion, and things will 
work.

Werner

>
>Stein
>
>----------------------------------------------------------- 
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-dev
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to