On Mon, Feb 1, 2010 at 10:34 AM, Scott Brady <[email protected]> wrote:
> I understand when doing a "manytoone" relationship that you can't have > this: > > <object name="Order"> > <id name="id" type="numeric" /> > <property name="fkiduser" type="numeric" /> > <onetomany name="User"> > <link column="fkiduser" to="user.User" /> > </onetomany> > </object> > > because you need to remove the "fkiduser" property. > > However, I'm having the issue in a onetomany relationship and can't > figure out a way around it. The doc state you need to remove the > property, but given how onetomany relationships are set up in the XML, > I don't know how to accomplish that. > > So, if the configuration was like the following, how would you get rid > of that error when doing an insert? > <object name="owners" table="owners"> > <id name="ownerID" column="ownerID" type="numeric" generate="false" > /> > <onetomany name="dogs"> > <link to="dogs" column="ownerID" /> > <collection type="array"> > <order property="dogID" order="asc" /> > </collection> > </onetomany> > </object> > > <object name="dogs" table="dogs"> > <id name="dogID" column="dogID" type="numeric" generate="false" /> > This property shouldn't be here, this is your problem. > <property name="ownerID" type="numeric" column="ownerID" > nullable="false" /> > </object> > > [The error occurs when trying to insert a new "dog"] > > I can't remove the "ownerID" property from the dogs object, because > then it tries to insert a null, and I don't know how to set it (since > there's no setter or getter for that property). > Check out the documentation for manageing o2m relationships: http://docs.transfer-orm.com/wiki/Managing_Relationships_and_Compositions.cfm#OneToMany You need to set a the parent on the child. > > Maybe I'm just not understanding how this is supposed to work (updates > work, but that's probably because the update statement has the column > listed twice, but that doesn't throw an error) > > -- E: [email protected] T: http://www.twitter.com/neurotic W: www.compoundtheory.com Hands-on ColdFusion ORM Training @ cf.Objective() 2010 www.ColdFusionOrmTraining.com/ -- Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups "transfer-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en
