2

I'm trying to join my pages cfc to itself to show child pages:

<cfproperty
    name="children"
    fieldtype="one-to-many"
    cfc="page"
    linktable="ParentAndChild"
    fkcolumn="parent"
    inversejoinColumn="child"
    mappedby="pageId"
    ormtype="string"
    lazy="true"
    missingRowIgnored="true"
>

I am getting the following error:

could not retrieve collection size: [children#dev-home]

its mappedby pageid because the id column isn't used in parentandchild, its using its human readable id.

'dev-home' is the parents pageid.

The parentandchild table has two columns: 'parent' and 'child', these hold the page id's

4

1 回答 1

1

我不确定你的错误。但我使用映射进行自联接,它工作正常。这些映射在 Page.cfc 中定义:

property
    name="Parent"
    fieldtype="many-to-one"
    cfc="Page"
    fkcolumn="fkpages"
;
property
    name="Children"
    fieldtype="one-to-many"
    cfc="Page"
    fkcolumn="fkpages"
    type="array"
    inverse="true"
    orderby="norder"
;

这是数据模型。复选框的意思是:允许为空。

在此处输入图像描述

于 2012-11-23T19:27:35.690 回答