Hello,
I've been trying this for hours without minimal success... I have a
A<->B relation the simpliest thing one can imagine. Each class has a
foreign key pointing to each other (a has bKey and b has aKey).
The problem is that when I check the database only one of the
instances have its foreign key value, the other one is zero.

I'm attaching my repository file and my business class that is
persisting the objects. I don't really understand why only one side of
the relation have the correct value.
In fact, in the attached files, I have some more occurencies of this
odd problem. However in 1:n bidirectional relationships its seems to
be no problem at all (maybe because there is only one foreign
key....).


I think this might be related to the fact that the value of a foreign
key is known only when the pointed instance is persisted... but how
can I fix this behaviour ?

And yes I'm using
                auto-retrieve="true"
                auto-update="none"
                auto-delete="none"
as recomended.

Please let me know if yoy have any ideas.

Best regards,
--
Gonçalo Luiz
<class-descriptor class="org.goncalo.smsbridge.domain.SmsBridge"
                  table="SMS_BRIDGE">

    <field-descriptor
        name="oid"
        column="OID"
        jdbc-type="INTEGER"
        primarykey="true"

        autoincrement="true"
    />
	<collection-descriptor

		auto-retrieve="true"
		auto-update="none"
		auto-delete="none"
        name="users"
        element-class-ref="org.goncalo.smsbridge.domain.User">
        
        <inverse-foreignkey field-ref="keyApplication"/>        	
    </collection-descriptor>
</class-descriptor>


<class-descriptor class="org.goncalo.smsbridge.domain.User"
                  table="USER">

    <field-descriptor
        name="oid"
        column="OID"
        jdbc-type="INTEGER"
        primarykey="true"

        autoincrement="true"
    />
    
    <field-descriptor
        name="keyApplication"
        column="KEY_APPLICATION"
        jdbc-type="INTEGER"

    />
    
    <field-descriptor
        name="keyPerson"
        column="KEY_PERSON"
        jdbc-type="INTEGER"

    />
    
    <field-descriptor
        name="username"
        column="USERNAME"
        jdbc-type="VARCHAR"
    />
    
    <field-descriptor
        name="password"
        column="PASSWORD"
        jdbc-type="VARCHAR"

    />

    <field-descriptor
        name="timesLoggedin"
        column="TIMES_LOGGED_IN"
        jdbc-type="INTEGER"

    />
           
	<reference-descriptor 
		auto-retrieve="true"
		auto-update="none"
		auto-delete="none"
        name="application"
        class-ref="org.goncalo.smsbridge.domain.SmsBridge">        
            <foreignkey field-ref="keyApplication"/>
    </reference-descriptor>
    
    <reference-descriptor 
		auto-retrieve="true"
		auto-update="none"
		auto-delete="none"
        name="person"
        class-ref="org.goncalo.smsbridge.domain.Person">        
            <foreignkey field-ref="keyPerson"/>
    </reference-descriptor>
    
</class-descriptor>    

    <class-descriptor class="org.goncalo.smsbridge.domain.Person"
                  table="PERSON">

    <field-descriptor
        name="oid"
        column="OID"
        jdbc-type="INTEGER"
        primarykey="true"

        autoincrement="true"
    />
    
    <field-descriptor
        name="keyAddressBook"
        column="KEY_ADDRESS_BOOK"
        jdbc-type="INTEGER"

    />
    
   <field-descriptor
        name="keyUser"
        column="KEY_USER"
        jdbc-type="INTEGER"

    />
    
    <field-descriptor
        name="name"
        column="NAME"
        jdbc-type="VARCHAR"

    />
               
	<reference-descriptor 
		auto-retrieve="true"
		auto-update="none"
		auto-delete="none"
        name="addressBook"
        class-ref="org.goncalo.smsbridge.domain.addressBook.AddressBook">
        
            <foreignkey field-ref="keyAddressBook"/>
    </reference-descriptor>

    <reference-descriptor 
		auto-retrieve="true"
		auto-update="none"
		auto-delete="none"
        name="user"
        class-ref="org.goncalo.smsbridge.domain.User">
        
            <foreignkey field-ref="keyUser"/>
    </reference-descriptor>
    
    </class-descriptor>
    
  <class-descriptor class="org.goncalo.smsbridge.domain.addressBook.AddressBook"
                  table="ADDRESS_BOOK">

    <field-descriptor
        name="oid"
        column="OID"
        jdbc-type="INTEGER"
        primarykey="true"

        autoincrement="true"
    />
    
    <field-descriptor
        name="keyOwner"
        column="KEY_PERSON"
        jdbc-type="INTEGER"

    />

	<reference-descriptor 
		auto-retrieve="true"
		auto-update="none"
		auto-delete="none"
        name="owner"
        class-ref="org.goncalo.smsbridge.domain.Person">
        
            <foreignkey field-ref="keyOwner"/>
    </reference-descriptor>
     
</class-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to