使用 Transfer-ORM 映射到我的 Microsoft SQL 数据库时,我收到以下 Coldfusion 错误。我相信这是由映射我的链接表的配置错误的 transfer.xml 文件引起的。我不确定我是否完全理解复合 ID 的细微差别。你看到错误了吗?
错误:
找不到搜索的属性在对象“siteUsers.siteUsers”中找不到属性“siteID”
索引.cfm:
<cfset transfer = application.transferFactory.getTransfer()>
<cfset obj = transfer.new("users.users")>
<cfdump var="#obj#">
transfer.xml:(相关部分-我认为问题存在于siteUsers包中)
<package name="users">
<object name="users" table="users" >
<id name="userID" type="string" generate="true"/>
<property name="username" type="string" column="username" nullable="false"/>
<property name="friendlyName" type="string" column="friendlyName" nullable="true"/>
<property name="email" type="string" column="email" nullable="true"/>
<property name="isEnabled" type="boolean" column="isEnabled" nullable="false"/>
<onetomany name="pages" lazy="true">
<link to="pages.pages" column="lastModUserID"/>
<collection type="array">
<order property="pageID" order="asc"/>
</collection>
</onetomany>
<onetomany name="siteUsers" lazy="true">
<link to="siteUsers.siteUsers" column="userID"/>
<collection type="array">
<order property="siteID" order="asc"/>
</collection>
</onetomany>
<onetomany name="textContent" lazy="true">
<link to="textContent.textContent" column="authorID"/>
<collection type="array">
<order property="textContentID" order="asc"/>
</collection>
</onetomany>
<onetomany name="textContent" lazy="true">
<link to="textContent.textContent" column="approvalUserID"/>
<collection type="array">
<order property="textContentID" order="asc"/>
</collection>
</onetomany>
</object>
</package>
<package name="siteUsers">
<object name="siteUsers" table="siteUsers" >
<compositeid>
<manytoone name="siteID" />
<manytoone name="userID" />
</compositeid>
<property name="accessLevel" type="string" column="accessLevel" nullable="false"/>
<manytoone name="siteID">
<link to="sites.sites" column="siteID"/>
</manytoone>
<manytoone name="userID">
<link to="users.users" column="userID"/>
</manytoone>
</object>
</package>
<package name="sites">
<object name="sites" table="sites" >
<id name="siteID" type="string" generate="true"/>
<property name="themeID" type="string" column="themeID" nullable="true"/>
<property name="sitename" type="string" column="sitename" nullable="false"/>
<property name="menuName" type="string" column="menuName" nullable="true"/>
<property name="menuID" type="string" column="menuID" nullable="true"/>
<property name="description" type="string" column="description" nullable="true"/>
<property name="basepath" type="string" column="basepath" nullable="true"/>
<property name="reqApproval" type="boolean" column="reqApproval" nullable="false"/>
<property name="enabled" type="boolean" column="enabled" nullable="false"/>
<property name="redirectPath" type="string" column="redirectPath" nullable="true"/>
<onetomany name="fileFolders" lazy="true">
<link to="fileFolders.fileFolders" column="siteID"/>
<collection type="array">
<order property="fileFolderID" order="asc"/>
</collection>
</onetomany>
<onetomany name="pages" lazy="true">
<link to="pages.pages" column="siteID"/>
<collection type="array">
<order property="pageID" order="asc"/>
</collection>
</onetomany>
<onetomany name="siteHandlers" lazy="true">
<link to="siteHandlers.siteHandlers" column="siteID"/>
<collection type="array">
<order property="siteID" order="asc"/>
</collection>
</onetomany>
<onetomany name="siteOptions" lazy="true">
<link to="siteOptions.siteOptions" column="siteID"/>
<collection type="array">
<order property="siteOptionID" order="asc"/>
</collection>
</onetomany>
<onetomany name="siteUsers" lazy="true">
<link to="siteUsers.siteUsers" column="siteID"/>
<collection type="array">
<order property="siteID" order="asc"/>
</collection>
</onetomany>
</object>
</package>