Hi!

I don't know if this solves your problem, but AFAIK, you can't mix <field-descriptor> with <extent-class>, as you have done in class-descriptor for A class.

More, I have no luck in using extent-class using a Interface as super-object. Have you tried an ABAbstractClass (I'm just trying a sidekick)?

Best regards,

Edson Richter


Bj�rn Voigt wrote:


OK, I have still no solution for my inheritance mapping problem.
There are my Classes A,B and C implementing the ABInterface, C and B
extend from A. I want to map each class to a distinct tables, but
on Multiple Joined Tables. The c an b table have its own primary column "b_id" and "c_id" and both a foreign key "a_id" referenes the a table.


        Table A:                         Table B:
 id | some_value_from_a       b_id | a_id | some_value_from_b
----+-------------------     ------+------+-------------------
  1 |              1000        100 |    1 |              1001
  2 |              2000

                                         Table C:
                              c_id | a_id | some_value_from_c
                             ------+------+-------------------
                               101 |    2 |              2002



Ok, if I query the ABInterface I want have two
instances, one of B and one of C, something like this:

    instance test.B id:1 a_value:1000 b_value:1001
    instance test.C id:2 a_value:2000 c_value:2002

But I get also instances of A, a query has this result:

    instance test.A id:1 a_value:1000
    instance test.A id:2 a_value:2000
    instance test.B id:1 a_value:1000 b_value:1001
    instance test.C id:2 a_value:2000 c_value:2002

But thats not all:

    instance into b values (1, 1, 1001);   instead of:
    instance into b values (100, 1, 1001);

has the following query-result:

    instance test.A id:1 a_value:1000
    instance test.A id:2 a_value:2000
    instance test.A id:1 a_value:1000
    instance test.C id:2 a_value:2000 c_value:2002

if b_id equals to an id of the a-table, or b_id equals
to a c_id in c-table, the result is another.

I am using rc5 and would be very happy, if you
can help me or give me an working example.


Bj�rn Voigt



Here follows my complete source code:


package test;
public class A implements ABInterface{
    int id;
    int someValueFromA;
    public String toString() {
        return this.getClass() + " id:" +id +" a_value:" +
        someValueFromA;
    }
}

package test;
public class B extends A {
    int b_id;
    int someValueFromB;

    public String toString() {
        return super.toString() + " b_value:" + someValueFromB;
    }
}

package test;
public class C extends A {
    int c_id;
    int someValueFromC;
    public String toString() {
        return super.toString() + " c_value:" + someValueFromC;
    }
}

<class-descriptor class="test.ABInterface">
<extent-class class-ref="test.A"/> <extent-class class-ref="test.B"/>
<extent-class class-ref="test.C"/> </class-descriptor>


<class-descriptor class="test.A" table="a">
<field-descriptor name="id" column="id" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" />
<field-descriptor name="someValueFromA" column="some_value_from_a" jdbc-type="INTEGER" />
<extent-class class-ref="test.B"/> <extent-class class-ref="test.C"/>
</class-descriptor>


<class-descriptor class="test.B" table="b">
<field-descriptor name="b_id" column="b_id" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" />
<field-descriptor name="id" column="a_id" jdbc-type="INTEGER"/>
<field-descriptor name="someValueFromB" column="some_value_from_b" jdbc-type="INTEGER"/>
<reference-descriptor name="super" class-ref="test.A">
<foreignkey field-ref="id"/>
</reference-descriptor>
</class-descriptor>


<class-descriptor class="test.C" table="c">
  <field-descriptor name="c_id" column="c_id" jdbc-type="INTEGER"
    primarykey="true" autoincrement="true" />
  <field-descriptor name="id" column="a_id" jdbc-type="INTEGER"/>
  <field-descriptor name="someValueFromC" column="some_value_from_c"
    jdbc-type="INTEGER"/>
  <reference-descriptor name="super" class-ref="test.A">
    <foreignkey field-ref="id"/>
  </reference-descriptor>
</class-descriptor>



---------------------------------------------------------------------
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