Hi, i know this is not the correct list to send this kind of problem, but i
don't find any other alternative,
then please:


Iam mapping my model of classes using "HIBERNATE", and i  have the next
scenario:

Two classes A and B, where A has an attribute of type B, i think this is an
ordinary many-to-one relationship, but the problem is that the id of the
class B is composed (composite-id), and in the declaration of a many-to-one
relationships in the maping file(hbm.xml) you can declare just one column to
match, so iam receving the
next error from the framework:

net.sf.hibernate.MappingException: Foreign key must have same number of
columns as referenced primay

The complete scenario is:

class A
{
    ....
    private B b;
    ....
}

B.hbm.xml:
<class name="B"...
    <composite-id>
        <key-property name="pk1".../>
        <key-property name="pk2".../>
    </composite-id>
    ...
</class>

A.hbm.xml:
<class name="A"...
    ....
    <many-to-one name="b" class="B" column="( here i can specify just one
column, but actually the key are two )" / >
    ....
</class>

PD: the two tables A and B on the DB2 has a strong relation, i mean, the
primary key of B reside on A as a foreign key.

Thanks

jars.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to