gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 08:36:56 24 4
gpt4 key购买 nike

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

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

我不知道为什么.. 我的数据库主键设置正确,并且我的 CFC 中有 setter=false 这些属性。我在进行 Google 搜索时发现了有关此错误的一些信息,但似乎没有任何内容表明是什么导致了我的问题。

这是我的 CFC。任何关于我可能做错的事情的指示都表示赞赏。提前致谢!

出版物.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";
}

出版文章.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" ;
}

出版物类型.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" ;
}

最佳答案

你需要一个发电机。

property name="id" fieldtype="id" generator="identity";

关于coldfusion - ORM EntitySave() - 必须在调用 save() 之前手动分配此类的 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9797213/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com