a couple things:
1. you don't need id="#" anymore. That's old and deprecated.
2. when using a foreignkey the field-id-ref should be field-ref if using the field 
name.
 
with this:
<reference-descriptor name="homeID" class-ref="com.lawton.business.HomeBO">
     <foreignkey field-ref="bHomeID"/>
</reference-descriptor>

your class com.lawton.business.BrokersToHomes must have a getter and setter for 
"homeID" that sets/gets a HomeBO object.

if that is your intent, it will work.

Take a look at the repository_junit.xml that ships with OJB, it has a ton of examples 
of how to do stuff like this.


        -----Original Message----- 
        From: Robert S. Sfeir [mailto:[EMAIL PROTECTED]] 
        Sent: Wed 2/12/2003 8:44 PM 
        To: oJB List 
        Cc: 
        Subject: reference-descriptors
        
        

        I want to test foreign keys in OJB, I have 3 class descriptor examples
        below, and I would like to know if in the last descriptor I've
        successfully mapped the homeID and brokerID of the BROKERS_TO_HOMES
        table to the HOMES homeID and BROKERS brokerID.
        
        
                <class-descriptor class="net.sfeir.business.HomeBO" table="HOMES">
                        <field-descriptor id="1" name="homeID" column="homeID"
        jdbc-type="INTEGER" autoincrement="true" primarykey="true"
        nullable="false"/>
        ...
                </class-descriptor>
        
                <class-descriptor class="net.sfeir.business.BrokersBO" 
table="BROKERS">
                        <field-descriptor id="1" name="brokerID" column="brokerID"
        jdbc-type="INTEGER" autoincrement="true" primarykey="true"
        nullable="false"/>
        ...
                </class-descriptor>
        
                <class-descriptor class="com.lawton.business.BrokersToHomes"
        table="BROKERS_TO_HOMES">
                        <field-descriptor id="1" name="recordID" column="recordID"
        jdbc-type="INTEGER" primarykey="true" autoincrement="true" />
                        <field-descriptor id="2" name="bBrokerID" column="brokerID"
        jdbc-type="INTEGER" nullable="false" />
                        <field-descriptor id="3" name="bHomeID" column="homeID"
        jdbc-type="INTEGER" nullable="false" />
                        <reference-descriptor name="homeID"
        class-ref="com.lawton.business.HomeBO">
                                <foreignkey field-id-ref="bHomeID"/>
                        </reference-descriptor>
                        <reference-descriptor name="brokerID"
        class-ref="com.lawton.business.BrokerBO">
                                <foreignkey field-id-ref="bBrokerID"/>
                        </reference-descriptor>
                </class-descriptor>
        
        Thanks
        R
        
        
        ---------------------------------------------------------------------
        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