Hi,

I' ve got a simple object with mandant, id as primary key. As such I can insert it 
into the database.
If I now define a relation to another object using a foreign key my insert fails with 
primary key missing.
This is due to the fact that the Relation Object is null, i.e. the relation is not 
defined for this object.

I do not understand why ojb "overwrites" my primary key (mandant) from the missing 
relation ? I am using ojb rc5 and SAPDB.

Thanks for any ideas,

Stefan

E.g.

create table Adresse(
  mandant VARCHAR(3) not null,
  id FIXED(32) not null,
   plz VARCHAR(200),
 fk_person FIXED(32),
 primary key (mandant, id)
);
create table Person(
  mandant VARCHAR(3) not null,
  id FIXED(32) not null,
   name VARCHAR(200),
 primary key (mandant, id)
);

<class-descriptor    class="test.AdresseValue" table="Adresse">
    <field-descriptor  name="mandant" column="mandant" jdbc-type="VARCHAR" 
primarykey="true"/>
    <field-descriptor  name="id" column="ID" jdbc-type="BIGINT" primarykey="true"/>
    <field-descriptor  name="plz" column="plz" jdbc-type="VARCHAR"/>

    <field-descriptor  name="fk_person" column="fk_person" jdbc-type="BIGINT"  />

       <reference-descriptor  name="personObj"  class-ref="test.PersonValue"
            auto-retrieve="false" auto-update="false" auto-delete="false">
        <foreignkey field-ref="mandant"/>
        <foreignkey field-ref="fk_person"/>
    </reference-descriptor>
   </class-descriptor>

The sql generated looks like this:
INSERT INTO Adresse (mandant,ID,plz,fk_person) VALUES ('','1','761','0')




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

Reply via email to