Robin, I'm still a little confused about what you are doing - are you saying that the structure of the object that comes in via xml differs from the one that you have persisted in the db, or just that the data is different? If it is just data, is object A complete, or does it just contain a delta of the changes? If it is complete, then load the original into B and commit, copy its timestamp into A, then pass A to the update() method...
HTH - Margaret -----Original Message----- From: Bruce Snyder [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 3:12 PM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] howto update jdo object in combination with xml ? This one time, at band camp, Robin Hoogeboom said: RH>Bruce, RH> RH>Thank you for your reply. RH> RH> RH>> 'Unfortunately it is not possible to change the objectreference RH>> and commit it.' RH>> RH>> Is this due to the fact that the communication is occurring via a web RH>service? RH>> RH>> Bruce RH> RH>My first assumption was that I could change the objectref to the marshalled RH>object RH>and commit this one. ObjectNotPersistentException is thrown this way... RH>Another idea would be to stream the object into the webservice and make RH>changes RH>to the object directly and send back and commit back the object.... RH> RH>We have to deal with a datamodel change runtime, so we cannot use this. RH>We change the datastructure by making changes into a DOM object and marshal RH>it. RH>This is where Castor is used... never ran into problems running xml RH>marshal/unmarshal ;-) RH> RH>After this proces we use Castor JDO to save changes made. That's why the RH>question comes up " howto update jdo object in combination with xml ? " RH> RH>Can I easily commit changes on an object which was originated from Castor RH>JDO, RH>but has lost its reference to the Castor persistent layer ?. RH>The answer is probably "no, you can't ", but you can't blame me for asking RH> RH>Now we use this sort of a solution: RH> RH>- receive a complete xml of changed object from webservice RH>- make a DOM object RH>- change datamodel/structure RH>- marshal it to Java object (A) RH>- load original from db (B) RH>- compare A with B RH>- make changes to B RH>- commit B RH> RH>If anyone knows a pitfall or other known issue with this approach RH>or has any idea about the earlier question mentioned I would like to hear RH>it. Thanks, your further explanation tells me what I need to know. I think that your answer is correct that this can't be done. I was actually thinking that marshalling the XML into a Java object, materializing the original data from the db and comparing the two objects for changes is the only solution. But I see that you're already doing this ;-). Anyone else have any crafty ideas? Bruce RH>----- Original Message ----- RH>From: "Bruce Snyder" <[EMAIL PROTECTED]> RH>To: <[EMAIL PROTECTED]> RH>Sent: Tuesday, November 26, 2002 2:57 PM RH>Subject: Re: [castor-dev] howto update jdo object in combination with xml ? RH> RH> RH>> This one time, at band camp, Robin Hoogeboom said: RH>> RH>> RH>I'm using jdo and xml package of Castor in one environment. RH>> RH> RH>> RH>from DB: RH>> RH> RH>> RH>load object RH>> RH>unmarshal it to xml RH>> RH>send it to webservice RH>> RH> RH>> RH>to DB: RH>> RH> RH>> RH>get xml from webservice RH>> RH>marshal it to object RH>> RH>create in DB RH>> RH> RH>> RH> RH>> RH>For reading and creating of records it works fine. But now RH>> RH>i'm trying to find a solution for updating records in the DB. RH>> RH> RH>> RH>In the process of updating i need to load the record into a RH>> RH>data object and set all the values from the marshalled object. RH>> RH>Unfortunately it is not possible to change the objectreference RH>> RH>and commit it. RH>> RH> RH>> RH>I can imagine that this problem has kept someone busy before. RH>> RH>I'm interested in a solution to this one. RH>> RH>> Robin, RH>> RH>> Please explain this situation a bit further. I'm not following the RH>statement: RH>> RH>> 'Unfortunately it is not possible to change the objectreference RH>> and commit it.' RH>> RH>> Is this due to the fact that the communication is occurring via a web RH>service? RH>> RH>> Bruce RH>> -- RH>> RH>> perl -e 'print RH>unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' RH>> RH>> ----------------------------------------------------------- RH>> If you wish to unsubscribe from this mailing, send mail to RH>> [EMAIL PROTECTED] with a subject of: RH>> unsubscribe castor-dev RH>> RH>> RH> RH>----------------------------------------------------------- RH>If you wish to unsubscribe from this mailing, send mail to RH>[EMAIL PROTECTED] with a subject of: RH> unsubscribe castor-dev RH> -- perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' ----------------------------------------------------------- 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
