Hi,
When I have a class hierarchy mapped to multiple (joined) tables then I
am not sure how to use the discriminator-descriptor. At least in the way
I try it it doesn't work.
An example I have a class A and its subclass B.
A is stored in table A and the subclass part of B is stored in table B. So get B a join has to be made between tables A and B.


In A I have a discriminator field (specified in the discriminator-descriptor).

I store one A and one B object creating two records in the A table and one in the B table. This is correct. The discriminator field in the A table however only contains the classname of A (for both records). This I think is not correct, for the B record it should contain the classname of B.

Also when I then retrieve all A objects I get two objects both of type A while one of the A object should actually be an instance of B.

Btw, in the case that I store the classhierarchy in one table then the above works fine.

As I am looking at the 1.1 branche I am not sure if this part is yet completely finished?
Maybe also my setup maybe wrong, see the repository.xml here:


<!-- class: org.elver.store.test.testcasesimple2.A in table: A -->
<class-descriptor class="org.elver.store.test.testcasesimple2.A" table="A">

<discriminator-descriptor column="A_classname" jdbc-type="VARCHAR" value="org.elver.store.test.testcasesimple2.A"/>

<field-descriptor name="name" column="name" jdbc-type="VARCHAR" nullable="true"/>
<field-descriptor name="ID" column="ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true" access="anonymous"/>


</class-descriptor>

<!-- class: org.elver.store.test.testcasesimple2.B in table: B -->
<class-descriptor class="org.elver.store.test.testcasesimple2.B" table="B">

<discriminator-descriptor column="B_classname" jdbc-type="VARCHAR" value="org.elver.store.test.testcasesimple2.B"/>

<field-descriptor name="nameb" column="nameb" jdbc-type="VARCHAR" nullable="true"/>

<field-descriptor name="A_ID" column="A_ID" jdbc-type="INTEGER" primarykey="true" access="anonymous"/>

<reference-descriptor name="super" class-ref="org.elver.store.test.testcasesimple2.A" auto-retrieve="true" auto-update="true" auto-delete="true">
<foreignkey field-ref="A_ID" />
</reference-descriptor>


</class-descriptor>

--

With Regards, Martin Taal

Springsite
Barchman Wuytierslaan 72b
3818 LK Amersfoort
tel: +31 (0)33 462 02 07
fax: +31 (0)33 463 77 12
Mobile: +31 (0)6 288 48 943
email: [EMAIL PROTECTED]
web: www.springsite.com


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



Reply via email to