This is currently not supported.  Collections and references currently
may be mapped only to the PK of the parent object.  However, the PK of
the object (as defined in the mapping) does not need to match the PK as
defined in the database.

-----Original Message-----
From: Daniel Spitzer [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 02, 2004 4:03 AM
To: [EMAIL PROTECTED]
Subject: Collection on Non-Primarykey Field


Hi list,

heres the problem:
I have two Entites mapping on two tables and want
the one of them to have a collection of the other
tables' elements, but the key is not the primarykey
of the collection-holding class, but another Field?

For Example:

<class-descriptor 
  class="Master"
  table="Master"
>
  <field-descriptor 
    name="master1"
    column="master1"
    jdbc-type="INTEGER"
    primarykey="true"
  />
  <field-descriptor 
    name="master2"
    column="master2"
    jdbc-type="INTEGER"
  />
  <collection-descriptor
    name="collSlaves"
    element-class-ref="slave"
  >
    <inverse-foreignkey field-ref="slave2"/>
  </collection-descriptor>
</class-descriptor>

<class-descriptor 
  class="Slave"
  table="Slave"
>
  <field-descriptor
    name="slave1"
    column="slave1"
    jdbc-type="INTEGER"
  />
  <field-descriptor 
    name="slave2"
    column="slave2"
    jdbc-type="INTEGER"
  />
</class-descriptor>

Now, I don't want the primarykey of Master to be
the key to get the slaves, but the Field master2.

How can this be accomplished?

My Guess would be something like this: 
  <collection-descriptor
    name="collSlaves"
    element-class-ref="slave"
  >
    <inverse-foreignkey field-ref="slave2"/>
    <foreignkey field-ref="master2"/>
  </collection-descriptor>

Well, this one didn't work out for me, of course ;)

Can anybody help me?

Greetings,
Gabor



        
                
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 100MB Speicher kostenlos - Hier
anmelden: http://mail.yahoo.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to