I think Castor is right in this message. In order to update an object, you must read it from the database in the same transaction. Otherwise, Castor would assume you are running in a long transaction where the update is independant of the transaction that has read the object.
I would suggest after beginning the transaction 1. Retrieve the object using the identity of the object you have read from xml 2. Copy the values from the xml object to the retrieved object 3. Update the retrieved object I think this would be the cleanest solution. HTH, Heiko Erhardt skynamics AG www.skynamics.com > -----Original Message----- > From: Thomas Louis [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 06, 2002 9:23 PM > To: [EMAIL PROTECTED] > Subject: [castor-dev] Why uses castor a long transaction > > > Hi, > > I've got another Problem. I want to update my products in the Database > like follows: > > // unmarshall a list of products from xml > ... > // iterate them > while (itor.hasNext()) { > xmlProduct = (Product)itor.next(); > db.begin(); > db.update(xmlProduct); > db.commit(); > } > > Why does castor abort with > > java.lang.IllegalArgumentException: A master object that involves in a > long transaction must be a TimeStampable! > > I either have any dependent objects nor a long transaction. Wrong? > Product has got Collections of other Objects, but these are not declared > dependent in the mapping file. > > Thanks for reply again, > Thomas > > ----------------------------------------------------------- > 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
