2012-03-21 1 views
7

EntitySave("publications",arguments);을 시도 할 때 다음 오류가 발생합니다.ORM EntitySave() - save()를 호출하기 전에이 클래스의 ID를 수동으로 할당해야합니다

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

나는 왜 작동하지 않을 수 있습니다. 내 데이터베이스의 기본 키가 올바르게 설정되어 있고, CFC에서 이러한 속성을 setter = false로 설정했습니다. Google 검색을 수행하면서이 오류가 있음을 발견했지만 아무 것도 내 문제의 원인을 나타내는 것 같지 않습니다.

여기 내 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

발전기 속성을 추가하려고 했습니까? 나는 발전기없이 기본 키 매핑을 시도한 적이 없다. http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSB7BEC0B4-8096-498d-8F9B-77C88878AC6C.html#WSA1F7CC44-F5A0-419c-B988-EC230EFF192E –

+0

s992, 당신은 내 영웅입니다! 설정 generator = "identity"가 트릭을했습니다. 기본 키 생성을 관리하는 데이터베이스가 있으므로 Entity에서이 작업을 수행 할 필요가 없다고 생각했습니다. 분명히 우리는 그렇게합니다. 나도 발전기 = "네이티브"(잘 작동했다)로 갈 수도 있었지만, 링크를 통해 '신분'을 보냈던 것이 더 나은 선택 인 것처럼 보인다. 당신이 답변으로 재 게시 할 수 있다면 나는 행복하게 기꺼이 신고 할 것입니다. 다시 한 번 감사드립니다! – Jason

답변