저는 ORM을 사용하기 시작했습니다. 혼란 스럽습니다. programtype 관계를 중심입니다 - 나의 이해에서Coldfusion ORM 혼란 : 엔티티 매핑을 반복했습니다.
**ProgramType**
programTypeID (PK)
programType varchar(50)
**Skill**
skillID (PK)
Skill varchar(50)
programTypeID(int) (FK)
내 스킬 :
테이블 : 여기
Error Occurred While Processing Request Repeated column in mapping for entity: skill column: programTypeID (should be mapped with insert="false" update="false")
내가 사용하고 기본 시나리오 : 여기 내 오류입니다 다 대일 ... 의미 많은 기술은 1 개의 프로그램 유형 만 가질 수 있습니다 ... 또는 1 개의 프로그램 유형은 많은 기술에 매핑 될 수 있습니다. Skill.cfc :
<cfcomponent persistent="true">
<cfproperty name="skillid" fieldType="id" generator="identity">
<cfproperty name="skill" ormType="string">
<cfproperty name="programTypeID" ormType="integer">
<cfproperty name="programType" fieldtype="many-to-one" fkcolumn="programTypeID" cfc="programType">
</cfcomponent>
ProgramType.cfc
<cfcomponent persistent="true" table="programtype">
<cfproperty name="programtypeid" fieldType="id" generator="identity">
<cfproperty name="programtype" ormType="string">
<cfproperty name="skill" fieldType="one-to-many" type="array" cfc="skill" fkcolumn="programTypeID" inverse="true">
</cfcomponent>
SkillEditForm.cfm
<cfoutput>
<form class="form-horizontal" action="submit.cfm" method="post">
<input name="skillid" type="hidden" value="#skill.getSkillid()#">
<div class="control-group">
<label class="control-label" for="programTypeID">Skill</label>
:
<div class="controls">
<select name="programTypeID">
<cfloop index="programType" array="#programTypes#">
<option value="#programType.getProgramTypeID()#"
<cfif programType.getProgramtypeid() eq skillProgramType.getProgramTypeid()>selected</cfif>
>#programType.getProgramType()#</option>
</cfloop>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="skill">Skill</label>
:
<div class="controls">
<input type="text" id="skill" placeholder="" name="skill" value="#skill.getSkill()#">
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Submit</button>
</div>
</div>
</form>
</cfoutput>
skill.cfc에서 programTypeID를 제거하면 오류가 사라집니다. 그러나 submit.cfc 페이지에서 엔티티를 추가하거나 업데이트 할 때 programTYpeID가 정의되지 않은 경우 혼란이 발생합니다 ... 폼의 선택 상자에서 programTypeID를 어떻게 설정합니까?
감사합니다. 나는 이것을 월요일에 시험 할 것이다. 말이되는 것 같아. 그런 식으로 설명하면, "필드 값"보다는 오히려 그 가치가 더 많은 것으로 간주됩니다. – steve
감사합니다. ORM에 대해 더 잘 이해할 수 있도록 안내해 드렸습니다. – steve