Hi Graeme Would it be acceptable to save in two passes (2 db transactions)?
If so, you could save billing address first, which will set its' object state to posClean so it won't be hit when AddressList is parsed. procedure TLearner.Save; begin BillingAddress.Save; Inherited Save; end; This will come unstuck if you have FK constraints eg. TAddress.Owner_OID => TLearner.OID on a new instance. Alternatively, something like this might work... procedure TLearner.Save; var lSaveBillingAddress: TAddress begin lSaveBillingAddress := BillingAddress; BillingAddress := nil; Inherited Save; BillingAddress := lSaveBillingAddress; end; Option #3... Have an alternative class (eg. TDBLearner - for want of a better name), which has BillingAddress as public and doesn't own TAddressList items. Create an instance of TDBLearner, assign properties directly across (ie. don't clone) and save this instead. (You may be able to do something win inheritance here.) Option #4 (warning: hack ahead)... Have GetBillingAddress function detect if it's within a save operation and answer nil instead!!! Plenty of ways to skin a cat! My 2c -- Ian > -----Original Message----- > From: Graeme Geldenhuys [mailto:[email protected]] > Sent: Friday, March 18, 2011 3:40 PM > To: [email protected] > Subject: [tiOPF-talk] How to save a object with a published reference property > > Hi, > > I'm in a bit of a pickle, and maybe because it's Friday I can't find a > solution. I'm converting data from our old system to our new system. So > contrary to how the program normally works, we now create all the data, > and then at the end call a massive Save. ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ tiOPF-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tiopf-talk
