Hi Stephen, till 1.3 release of Castor there are 2 requirements for entities that are used at long transactions.
- the entity have to implement the TimeStampable interface - the entity has to stay in cache from being loaded until update is called with it According to your test scenarios the second seams not to be the case (case 2). Backgroud of the ObjectModifiedException in cases 1 and 3 is, that an entity always gets a new timestamp value when it is loaded from database. As the entity you explicitly loaded into cache in cases 1 and 3 got a different timestamp the ObjectModifiedException gets thrown at update. To prevent this you have to use cache type 'unlimited' or 'time-limited' with a ttl that is bigger than the time between you initial load and the call to update. Having said that this also does not help if the entity is part of an extends hierarchy. There is a open issue (castor-1217) about that. If keeping entities in cache for such a long time is not an option to you, maybe according to the number of entities involved, or the entity is part of an extends hierarchy, there are only 2 options. - copy changed properties of the entity by hand into an entity loaded in the transaction - switch to the upcoming 1.3 release which allows to persist the timestamp in database If you like to know more about persisting timestamp let me know and I'll point you into the right direction. To reduced turnaround you may want to connect to castor channel at: http://irc.codehaus.org/ Regards Ralf Stephen Ince schrieb: > I am getting a "org.exolab.castor.jdo.ObjectModifiedException: > Timestamp mismatched!" error when saving a long transactions. How can > I avoid this. I have tried the following. > > case 1: > db.begin(); > > db.load(UserScenario.class,u.getUserScenarioId(),AccessMode.ReadOnly)); > db.update(u); > db.commit(); > > case 2: > db.begin(); > db.update(u); > db.commit(); > I get object not in cache error for this case. > > case 3: > db.begin(); > > db.load(UserScenario.class,u.getUserScenarioId(),AccessMode.ReadOnly)); > db.commit(); > > db.begin(); > db.update(u); > db.commit(); > > Steve > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > -- Syscon Ingenieurbüro für Meß- und Datentechnik GmbH Ralf Joachim Raiffeisenstraße 11 72127 Kusterdingen Germany Tel. +49 7071 3690 52 Mobil: +49 173 9630135 Fax +49 7071 3690 98 Internet: www.syscon.eu E-Mail: [EMAIL PROTECTED] Sitz der Gesellschaft: D-72127 Kusterdingen Registereintrag: Amtsgericht Stuttgart, HRB 382295 Geschäftsleitung: Jens Joachim, Ralf Joachim --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email