Hi Christopher

    When will you put this correction in the CVS?

    [ ]�s
     Cesar

----- Original Message -----
From: "Christopher C Worley" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, September 17, 2003 5:40 PM
Subject: Re: Extent problem with multiple classes and tables


> Jakob,
>
> After looking at you test case in noticed I was not using anonymous
> fields to represent my fk to the super class.  I changed my code to do
> this and it works fine.   Is this the way it should be done?
>
> The only question i have is how do i get my pk to go in order.  it
> appears all three tables use the same sequence name.
>
> -chris worley
>
> > hi christopher,
> >
> > i had to remove the patch becaus of stack overflow and other errors.
> >
> > jakob
> >
> > Jakob Braeuchi wrote:
> >
> >> hi christopher,
> >>
> >> thanks for the patch.
> >> i checked it in and also added new testcases in class
> >> AnonymousFieldsTest to verify multilevel vertical inheritance.
> >>
> >> jakob
> >>
> >> Christopher C Worley wrote:
> >>
> >>>
> >>> I have finnaly found a solution to the problem with mapping more
> >>> than two classes to multiple joined tables.
> >>> Currently an exception occures becuase no primary key has been
> >>> assinged to class A which does have the auto increment set to true.
> >>> The reason is ojb only follows the hierarchy up one level.  Which is
> >>> why two class work fine.  To solve the problem i added
> >>> assignReferenceFKs(ref, refCld.getObjectReferenceDescriptors()) to
> >>> PersistenceBrokerImpl.assertFkAssignment(...).
> >>>
> >>> ----------- Begin Code --------------
> >>> if (ref == null)
> >>> {
> >>>   refPkValues = new Object[objFkFields.length];
> >>> }
> >>> else
> >>> {
> >>>   // BRJ: ref may be Proxy
> >>>   Class refClass = ProxyHelper.getRealClass(ref);
> >>>   ClassDescriptor refCld =
> >>> descriptorRepository.getDescriptorFor(refClass);
> >>>
> >>>   //  Add this line to assign reference FKs
> >>>   assignReferenceFKs(ref, refCld.getObjectReferenceDescriptors());
> >>>   refPkValues = brokerHelper.getKeyValues(refCld, ref, false);
> >>> }
> >>> ----------- End Code --------------
> >>>
> >>> The test cases for 1.0rc4 passed with this line.  Could sombody
> >>> review this and get a fix into cvs.
> >>>
> >>> -chris worley
> >>>
> >>>> Oliver,
> >>>>
> >>>> Below is an example of my reposity.
> >>>> if i call broker.store(B) bother records for A and B get created
> >>>> fine.  When I store C I get a message saying pk is not valid for
> >>>> C.  I think when validating the PK for see it should get the
> >>>> auto-increment from A, but it does not.  If i set the pk myself it
> >>>> exceptions out trying to add null value to C.id which is odd. If i
> >>>> set auto-increment=true on B then all three classes get store but
> >>>> with different pk's.
> >>>>
> >>>> 7     WARN  [main] root -
> >>>> org.apache.ojb.broker.PersistenceBrokerException:
> >>>> assertValidPkFields failed for Object of type: C on insert
> >>>>    at
> >>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown
> >>>> Source)
> >>>>
> >>>>
> >>>> -----------------------
> >>>>
> >>>>    <class-descriptor
> >>>>        class="A"
> >>>>        table="A_TABLE"
> >>>>    >
> >>>>        <field-descriptor id="1"
> >>>>            name="Id"
> >>>>            column="ID"
> >>>>            jdbc-type="INTEGER"
> >>>>            primarykey="true"
> >>>>            autoincrement="true"
> >>>>        />
> >>>>        <field-descriptor id="2"
> >>>>            name="aValue"
> >>>>            column="A_VALUE"
> >>>>            jdbc-type="VARCHAR"
> >>>>        />
> >>>>    </class-descriptor>
> >>>>
> >>>>    <class-descriptor
> >>>>        class="B"
> >>>>        table="B_TABLE"
> >>>>    >
> >>>>        <field-descriptor id="1"
> >>>>            name="Id"
> >>>>            column="ID"
> >>>>            jdbc-type="INTEGER"
> >>>>            primarykey="true"
> >>>>        />
> >>>>        <field-descriptor id="2"
> >>>>            name="bValue"
> >>>>            column="B_VALUE"
> >>>>            jdbc-type="VARCHAR"
> >>>>        />
> >>>>              <reference-descriptor
> >>>>            name="super"
> >>>>            class-ref="A"
> >>>>            auto-update="true"
> >>>>        >
> >>>>            <foreignkey field-ref="Id"/>
> >>>>        </reference-descriptor>
> >>>>
> >>>>        <extent-class class-ref="A"/>
> >>>>
> >>>>    </class-descriptor>
> >>>>
> >>>>    <class-descriptor
> >>>>        class="C"
> >>>>        table="C_TABLE"
> >>>>    >
> >>>>        <field-descriptor id="1"
> >>>>            name="Id"
> >>>>            column="ID"
> >>>>            jdbc-type="INTEGER"
> >>>>            primarykey="true"
> >>>>        />
> >>>>        <field-descriptor id="2"
> >>>>            name="cValue"
> >>>>            column="C_VALUE"
> >>>>            jdbc-type="VARCHAR"
> >>>>        />
> >>>>              <reference-descriptor
> >>>>            name="super"
> >>>>            class-ref="B"
> >>>>            auto-update="true"
> >>>>        >
> >>>>            <foreignkey field-ref="Id"/>
> >>>>        </reference-descriptor>
> >>>>
> >>>>        <extent-class class-ref="B"/>
> >>>>
> >>>>    </class-descriptor>
> >>>>
> >>>>
> >>>>> Hello Chris,
> >>>>>
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Christopher C Worley [mailto:[EMAIL PROTECTED]
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> Still having problems with this.  I have a question about
> >>>>>> defining extents.  In the below explination would C be the only
> >>>>>> class I would have to define the extent classes for or would it
> >>>>>> be in A?
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> In the situation C extends B extends A you need:
> >>>>>
> >>>>> <class-descriptor class="C">
> >>>>>     <extent-class class-ref="B"/>
> >>>>> </class-descriptor>
> >>>>>
> >>>>> <class-descriptor class="B">
> >>>>>     <extent-class class-ref="A"/>
> >>>>> </class-descriptor>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>> I have been successfull at handling mapping extents (two classes
> >>>>>>> to two tables).  Whe I add a third class I get
> >>>>>>> "assertValidPkFields failed for Object of type..." error.
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>> What is the precise message text?
> >>>>>
> >>>>>
> >>>>>
> >>>>>>> is null so it updates the referenceFKs.  When it does this it
> >>>>>>> only looks at the B reference which is null.  So, I get this
> >>>>>>> error.  I
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>> Which B reference?
> >>>>>
> >>>>> Can you explain more detailed?
> >>>>>
> >>>>> Olli
> >>>>>
>
>>>>> ---------------------------------------------------------------------
> >>>>> 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]
> >>>>
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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]
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>


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

Reply via email to