CF9 ORM - One-To-One Mapping, Repeated Column Error

2009-09-22 Thread Jeff Chastain

I am looking at the one-to-one relationship, unique foreign key mapping
example in the ColdFusion 9 ORM documentation ..

 

 
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS5FFD2854-7F18-43ea-B
383-161E007CE0D1.html#WS606584AD-43B2-48c1-B9E6-69A670694BBB

 

. and I am wondering why the Empolyee.cfc has the primary key defined as
EmployeeID whereas the OfficeCubicle.cfc has the primary key defined as id?
In most of the other examples, the primary key is just named 'id', so is
there something special here that requires the Employee object to have the
PK as EmployeeID instead?

 

I have a similar setup defined in a project I am working on, but both
objects have their PK named 'id' and I am getting an error that there is a
Repeated column in mapping for entity: Response column: id (should be
mapped with insert=false update=false).

 

cfcomponent displayname=Response output=false persistent=true

  extends=com.alagad.PersistentBO

  hint=A response to a survey 

 

  cfproperty name=id type=numeric fieldtype=id ormtype=integer
generator=native setter=false notnull=true 

hint=I am the unique identifier for the Response /

 

  cfproperty name=prize fieldtype=one-to-one cfc= Prize
fkcolumn=id

hint=I am the Prize which was (optionally) awarded for this
Response /

 

 

cfcomponent displayname=Prize output=false persistent=true

  hint=A conference Prize to be awarded to a participant 

 

  cfproperty name=id type=numeric fieldtype=id ormtype=integer
generator=native setter=false notnull=true 

hint=I am the unique identifier for the Prize /

  

  cfproperty name=winningResponse fieldtype=one-to-one cfc=
Response mappedBy=prize

hint=I am the winning response associated with this prize if it
has been awarded /

 

Any ideas?

 

Thanks

-- Jeff



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326486
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF9 ORM - One-To-One Mapping, Repeated Column Error

2009-09-22 Thread Brian Kotek

fkcolumn should specify the name of the foreign key column, not the name of
the primary key on the other table. In most cases this attribute shouldn't
need to be specified at all, Hibernate will create a column for the foreign
key automatically. So either the docs are just badly worded, or they
deliberately named the keys differently to try and highlight the difference
(as opposed to having both primary keys be named id).

On Tue, Sep 22, 2009 at 10:12 AM, Jeff Chastain li...@admentus.com wrote:


 I am looking at the one-to-one relationship, unique foreign key mapping
 example in the ColdFusion 9 ORM documentation ..





 http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS5FFD2854-7F18-43ea-B
 383-161E007CE0D1.html#WS606584AD-43B2-48c1-B9E6-69A670694BBBhttp://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS5FFD2854-7F18-43ea-B%0A383-161E007CE0D1.html#WS606584AD-43B2-48c1-B9E6-69A670694BBB



 . and I am wondering why the Empolyee.cfc has the primary key defined as
 EmployeeID whereas the OfficeCubicle.cfc has the primary key defined as id?
 In most of the other examples, the primary key is just named 'id', so is
 there something special here that requires the Employee object to have the
 PK as EmployeeID instead?





~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326496
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4