Looks like setting lazy="true" for both onetomany's solves the
identical struct problem. One always being empty, I can safely merge
them into one struct so I don't have to decide which one to choose.

Still puzzles me why this is happening...


On Oct 9, 1:26 pm, acdhirr <[EMAIL PROTECTED]> wrote:
> Dear folks at the transfer list,
>
> Please help me with a tough issue.
>
> I have a table structure as below (simplified transfer xml)
>
> Contacts basically stores addresses of both persons and
> organizations.
> Each organization can be linked to several persons, whereas each
> person can be linked to
> several organizations.
>
> A linking table is required, but it's not just a linking table, it
> also stores information
> describing the type of relationship between a person and an
> organization and a number of other fields.
> Therefore I can't use a manytomany.
>
> The linking table links Contacts to Contacts.
>
> This is my (simplified) transfer:
>
> <object name="Contacts" table="contacts">
>
>         <id name="IDContact" column="code" type="string" />
>         ...
>
>         <onetomany name="repr1">
>                 <link to="Representatives" column="IDPerson" />
>                 <collection type="struct">
>                         <key property="IDRepresentative" />
>                 </collection>
>         </onetomany>
>
>         <onetomany name="repr2">
>                 <link to="Representatives" column="IDOrganization" />
>                 <collection type="struct">
>                         <key property="IDRepresentative" />
>                 </collection>
>         </onetomany>
>
> </object>
>
> <object name="Representatives" table="representatives">
>
>         <id name="IDRepresentative" />
>         <property name="IDPerson" />
>         <property name="IDOrganization" />
>         <property name="job" />
>         ...
>
> </object>
>
> Since manytomany is not an option, I took two onetomany's. That's
> going to return me 2 structs:
>
> Contact.getRepr1Struct() and  Contact.getRepr1Struct().
>
> Strangely, when IDContact links to IDPerson I get only one struct
> containing Representative objects, but
> when IDContact links to IDOrganization I get 2 identical structs.
>
> Now I can live with that, with some conditional logic I could test to
> see if at least one struct
> is loaded and then take that struct.
>
> But it just strikes me as odd, which could suggest that I am
> completely going the wrong direction.
>
> So I was wondering if anyone has an explanation for this behaviour, or
> maybe another approach for these
> self referencing many-to-many's.
>
> Thanks,
> Richard
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to