[EMAIL PROTECTED] wrote:
>Hej Keith,
>
>>-----Original Message-----
>>From: Keith Rogers [mailto:[EMAIL PROTECTED]
>
>
>>No, it doesn't seem to work as is - when I do a query for all
>>articles, I only get implementations of article back (I'm
>>using the map-each-instance-to-a-different-table approach),
>>rather than the classes that they actually are.
>
>
>strange. There must be something wrong in your
>repository_user.xml.
>
>Maybe we'll find it if you post a snippet.
>
>Have you checked (with an external tool, maybe a text editor
>in case of hsqldb) in which table the data is actually stored? Just
>to be sure whether the problem is during store or retrieve.
>
>Olli
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
Hi Keith,
hi Olli,
I got the same problem using this inheritance mapping approach, too.
Storing the objects works fine, but loading them produces base class
instances only.
By now I did a workaround (storing a "classid" and loading an id-object from
the "base class table",
that indicates wich derived class to use for the "real" query).
I would like to drop this workaround, maybe you find an error in my
mappings.
All following code snippets do NOT contain the workaround.
Sorry for posting the var names in german, but I want to prevent from
logical mistakes when translating them.
The code snipped for loading the object:
criteria.addEqualTo("myKundennummer", new Integer(aKundennummer));
QueryByCriteria theTestQuery = QueryFactory.newQuery(Person.class,
criteria);
results = broker.getCollectionByQuery(theTestQuery);
My mappings:
<!-- NatuerlichePerson = NaturalPerson -->
<!-- Kundennummer = CustomerId -->
<class-descriptor class="Person" table="PERSONEN">
<field-descriptor
column="KUNDENNUMMER"
jdbc-type="INTEGER"
name="myKundennummer"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
column="ERSTKONTAKT"
jdbc-type="BIGINT"
name="myErstkontakt"
conversion="LongToDateConversion"
/>
</class-descriptor>
<class-descriptor
class="NatuerlichePerson"
table="NATUERLICHEPERSONEN"
>
<field-descriptor
column="KUNDENNUMMER"
jdbc-type="INTEGER"
name="myKundennummer"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
column="ID"
jdbc-type="INTEGER"
name="superID"
access="anonymous"
/>
<field-descriptor
name="myName"
column="NAME"
jdbc-type="VARCHAR"
/>
<reference-descriptor
name="super"
class-ref="Person"
auto-retrieve="true"
auto-update="true"
auto-delete="true"
>
<foreignkey field-ref="superID"/>
</reference-descriptor>
</class-descriptor>
Thank you for your time.
Regards,
Michael
--
GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]