Sean,
Thanks for the reply! Unfortunately, the organisations and persons are
not related directly. This is my transfer.xml file:
<package name="dc">
<object name="Organisation" table="organisations">
<id name="OrgId" type="string" generate="false" column="ORG_ID" />
<property name="CommonName" type="string" nullable="false"
column="COMMON_NAME" />
...
<onetomany name="OrgPerson" lazy="true">
<link to="dc.OrgPerson" column="ORG_ID" />
<collection type="struct">
<key property="OrgPersonId"/>
</collection>
</onetomany>
</object>
<object name="Person" table="DC_PERSONS">
<id name="PersonId" column="PERSON_ID" type="string"
generate="false" />
<property name="FirstName" type="string" nullable="false"
column="FIRST_NAME"/>
<property name="FamilyName" type="string" nullable="false"
column="FAMILY_NAME"/>
...
<onetomany name="OrgPerson" lazy="true">
<link to="dc.OrgPerson" column="PERSON_ID" />
<collection type="struct">
<key property="OrgPersonId"/>
</collection>
</onetomany>
</object>
<object name="OrgPerson" table="DC_ORG_PERSON" >
<id name="OrgPersonId" column="ORG_PERSON_ID" type="string"
generate="false" />
<property name="PersonId" type="string" nullable="false"
column="PERSON_ID" />
<property name="OrgId" type="string" nullable="false"
column="ORG_ID" />
<property name="Role" type="string" nullable="false" column="ROLE" /
>
<property name="StartDate" type="date" nullable="true"
column="START_DATE" />
<property name="EndDate" type="date" nullable="true"
column="END_DATE" />
</object>
As I need to have many roles per person and organisation, i.e. a many-
to-many relation between organisations and persons with extra data in
the linking table.
I'd like to append the OrgPerson Struct that belongs to Organisation
2, to the Organisation 1 that replaces it. Something like:
<cfset org1persons = org1.getPersonsStruct() />
<cfset org2persons = org2.getPersonsStruct() />
<cfset StructAppend(org1persons, org2persons, true) />
<cfset org1.setPersonsStruct(org1persons) />
I'd like to avoid looping through all org2persons struct members. Is
your commendation something like the following?
<cfloop collection="#org2persons#" item="OrgPersonId" >
<cfset orgpersons[OrgPersonId].setParentOrganization(org1) />
</cfloop>
TIA,
Pedro.