2013-01-11 1 views
1

일대일 여러 CFC -ColdFusion에서 9 ORM 내가 CF9 ORM을 사용하고

나는 내가 하나의 특정 객체에 일대일 관계를 가질 수있는 여러 개체가 개체 모델이있다. 두 가지 잠재적 인 CFC 중 하나에 역관계를 구체화 할 수있는 방법이 있습니까?

CFC의 1A (ProblemType1) :

property name="Product" cfc="Product" fieldtype="one-to-one" fkcolumn="productID" ; 

CFC의 1B (ProblemType2) :

property name="Problem" fieldtype="one-to-one" cfc=???; 

나는이에 대한 인터페이스를 사용할 수 : 2

property name="Product" cfc="Product" fieldtype="one-to-one" fkcolumn="productID" ; 

CFC? 또는...?

답변

3

CFC 1a 및 CFC 1b는 모두 상위 엔티티 인 CFC 1의 하위 클래스가 될 수 있습니다. CFC 1은 두 하위 클래스 모두에 상속 될 "Product"와의 관계를 가져야합니다. CFC 2는 그 관계에서 CFC 1을 가리킬 수 있습니다.

샘플 엔티티 :이 접근을 할 경우

/** CFC 1 **/ 
component persistent="true" { 

    property name="Product" cfc="Product" fieldtype="one-to-one" fkcolumn="productID"; 

} 

/** CFC 1a **/ 
component persistent="true" extends="baseProblem" { 

    // problemtype1 specific properties go here 

} 

/** CFC 1b **/ 
component persistent="true" extends="baseProblem" { 

    // problemtype2 specific properties go here 

} 

/** CFC 2 **/ 
component persistent="true" { 

    property name="Problem" fieldtype="one-to-one" cfc="baseProblem"; 

} 

, 당신은 아마, inheritance mapping 들여다 특히 discriminatorColumndiscriminatorValue 속성이 필요합니다. DB 스키마가 어떻게 설정되었는지 알지 못하면이 점에 대해 더 많은 조언을하기는 어렵지만 문서를 작성해야합니다.

+0

ORM과 관련된 상속에 대한 나의 이해가 부족했습니다. 링크와 안내에 감사드립니다. –