Is this being mapped to an already existing database? What are you ormsettings in application.cfc
And you are right, unless you are mapping to an existing DB where the realtionships and constraints are already setup, then you would assume that you can't. However I am guessing you have ORM setup to update the DB and modify it, which means that your relationships are not correctly setup For any Composite Key in ORM you need to define them both in the FK of your relationship, which you are not doing here. Hope that makes sense. Also you might want to join CF-ORM which is a group dedicated to the ORM side of ColdFusion and has all the smarter people who know this stuff backwards in there. On Wed, Aug 10, 2011 at 10:38 PM, Glyn Jackson <[email protected]>wrote: > > Hi, > > Just trying to understand this issues, maybe I have missed something.... > > I created a many-to-many relationship in ORM (see below). When I add an > account to a scape i.e. addAccount(account) the second time I add the 'same' > account to the scape I 'should' get an error because of the composite key. > > However, ORM happily adds it! > > Scape.cfc > property name="Accounts" singularname="Account" fieldtype="many-to-many" > cfc="pAccount" fkcolumn="scapeID" inversejoincolumn="accID" > linktable="pLinkScapesAccount"; > > Account.cfc > property name="Scapes" singularname="Scape" fieldtype="many-to-many" > cfc="pScape" fkcolumn="accID" inversejoincolumn="scapeID" > linktable="pLinkScapesAccount"; > > What should I have done? There should never be two composite keys the same > in the link table so why does ORM let me do this? Is there a way to force > the correct behaviour? > > > Thanks for you help > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346645 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

