ORM EntitySave() - 在调用save()之前必须手动分配此类的ID

时间:2012-03-21 00:55:57

标签: coldfusion coldfusion-9

尝试执行EntitySave("publications",arguments);时,我收到以下错误。

ids for this class must be manually assigned before calling save(): publications

我无法解决原因..我的数据库主键设置正确,我在CFC中设置了setter = false这些属性。我在谷歌搜索时发现了一些错误,但似乎没有任何迹象表明这是导致我的问题。

这是我的CFC。关于我可能做错的任何指示都表示赞赏。非常感谢大家!

Publications.cfc

component persistent="true" table="publications"  
hint="Publications"{
    property name="id" fieldtype="id" setter="false";
    property name="typeid" omrtype="int";
    property name="name" ormtype="string";
    property name="dateScheduled" ormtype="date" ;
    property name="tstamp" ormtype="date";

    property name="Article" fieldtype="one-to-many" cfc="publicationArticles" fkcolumn="publicationid";
}

publicationArticles.cfc

component persistent="true" table="publicationArticles"  
hint="Publications"{
    property name="id" fieldtype="id" setter="false"   ;
    property name="typeid" ormtype="int";
    property name="title" ormtype="string" ;
    property name="status" ormtype="boolean";

    property name="publication" fieldtype="many-to-one" cfc="publications" fkcolumn="publicationid" ;
}

publicationTypes.cfc

   component persistent="true" table="publicationTypes"    
hint="Publicatin Type - Lookup"{

    property name="id" fieldtype="id" setter="false"   ;
    property name="description" ormtype="string";

    property name="publications" fieldtype="one-to-many" cfc="publications" fkcolumn="typeid" ;
}

1 个答案:

答案 0 :(得分:4)