English 中文(简体)
我如何绘制一个提到两个表格的外国关键栏图?
原标题:How do I to map a foreign key column referring two tables?

在使用口服体会的“未来”中,我如何规划一个涉及两个表格的外在关键一列?

我的例子。

At the moment an Image can belong to either a human or alien

Image.cfc
property name="imageID" fieldtype="id" generator="guid";

// Related Object Properties (many-to-one)
property name="Human" fieldtype="many-to-one" fkcolumn="HumanID" cfc="human";
property name="Alien" fieldtype="many-to-one" fkcolumn="AlienID" cfc="alien";

这使我想到这样一个表。

Image.cfc

    ID   NAME    HumanID  AlienID
    1    img1    10       NULL
    2    img2    NUll     8

对我来说,联合国利比里亚人民军 s!

因此,我能够用两种物体的地图来取代这一数据? 或者,如果我设立一个分类表? 任何想法?

成就

船舶

最佳回答

你们可以把单一财产描绘给不止一个母物。 因此,你在此有两个选择。

页: 1 如果你有延长基象级的人类学和爱伦伊语课程

// Image.cfc
component persistent="true" {
    property name="id" generator="guid";
    property name="name";   
}

// AlienImage.cfc & HumanImage.cfc
component persistent="true" extends="Image" joincolumn="id" {
}

// Alien.cfc
component persistent="true"  {
    property name="id" generator="guid";
    property name="Image" fieldtype="one-to-many" cfc="AlienImage"
      fkcolumn="fkAlienID";
}

// Human.cfc
component persistent="true"  {
    property name="id" generator="guid";
    property name="Image" fieldtype="one-to-many" cfc="HumanImage"
      fkcolumn="fkHumanID";
}
问题回答

暂无回答




相关问题
JQuery AJAX .load - flash chart doesnt load in IE

An IE issue has me completely stumped. I have a coldfusion page that uses JQuery s AJAX .load function to load in a new flash file that is generated by coldFusion s cfchart tag. This works completely ...

Best Coldfusion Library for OpenID [closed]

I am getting ready to start a project that requires using OpenID within Coldfusion 8. I have found a number of different options and was wondering what has worked the best, get s the most support, ...

Find ColdFusion Generated ID

Is there a way to find the elements generated by ColdFusion s <CFLayout> and <CFLayoutArea> tags? These tags: <cflayout type="tab" name="MyAccount"> <cflayoutarea name="...

ColdFusion COM error

I am upgrading from CF4.5 to CF8. Calls to COM dll s that used to work in version 4.5 now throw a "Complex object types cannot be converted to simple values.." error. The COM object has a few arrays ...

What s the best way to write engine-specific CFML code?

Sometimes it is necessary to write different code for Adobe ColdFusion vs Railo vs OpenBD, due to differences in implementation. Do people have a specific method that they use for this? For example, ...

热门标签