Transfer-ORM: The property 'siteID' could not be found in the object 'siteUsers.siteUsers'

230 views Asked by At

I'm getting the following Coldfusion error when using Transfer-ORM to map to my Microsoft SQL database. I believe it's caused by a misconfigured transfer.xml file that maps out my linking table. I'm not sure I entirely understand the nuances of the composite id. Do you see the error?

Error:

The property that was searched for could not be found The property 'siteID' could not be found in the object 'siteUsers.siteUsers'

index.cfm:

<cfset transfer = application.transferFactory.getTransfer()>
<cfset obj = transfer.new("users.users")>
<cfdump var="#obj#">

transfer.xml: (relevant parts - I think the problem exists in the siteUsers package)

<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>
2

There are 2 answers

0
Dan Sorensen On

To properly configure Transfer-ORM, there are three things to validate about the configuration file:

  1. Is it properly formed XML?

  2. Does it conform to the transfer.xsd schema file?

  3. Do the relationships in your transfer.xml match the relationships in your database?

I passed validation on #1 and #2, but was using the wrong relationship tags in #3.

More info:

2
Sergey Galashyn On

Possible reason is that you define both o2m and m2o for same relationship. As I remember, this is not allowed.