I have a many-to-many relationship in which some extra
attributes are stored in the join table.  Consider the
following tables:

Client ( clientId int PK )
Contact ( contactId int PK, attr1, attr2... )
ContactToClient ( clientId FK, contactId FK,
relationshipTypeId int )

-----
I need to retrieve all Contacts associated with a
given client, including attr1, attr2..., and the
relationshipTypeId which is stored in the join table. 
I have been using many-to-relationships in sets to
retrieve many-to-manies, like the following, which
comes from Client.hbm.xml:

        <set name="relatives" lazy="false"
inverse="true" cascade="none" table="ContactToClient" 
        
sort="com.sysinct.basecode.util.DomainObjectSorterDescending">
           <key column="clientId"/>
           <many-to-many
class="com.sysinct.essist.ati.domain.Contact"
column="contactId" />
                </set>

but cannot figure out how to include the
relationshipTypeId attribute.  Also, I'm not sure
where to store the relationshipTypeId attribute. 
Right now, I have it in the Contact class, but I don't
know how to map it as a property in Contact.hbm.xml. 
Any ideas?

Austin Rosenfeld


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to