[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ojb-user
Subject:    Mapping Classes on Multiple Joined Tables
From:       Stefan Walkner <walkner.stefan () sbg ! at>
Date:       2005-04-20 10:52:35
Message-ID: 200504201252.35554.walkner.stefan () sbg ! at
[Download RAW message or body]

hello,

I use Mapping Classes on Multiple Joined Tables to map an Object which 
inherits from another into two tables.
BUT: is there a way to get the different objects back, when querying?
I mean, I have following mappings:
--------------------------------------------------
<class-descriptor class="item.Item" table="items">
    
    <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl" />

    <field-descriptor
                     name="itemCode"
                     column="item_code"
                     jdbc-type="INTEGER"
                     primarykey="true"
                     autoincrement="true" />

    <field-descriptor
                     name="name"
                     column="item_name"
                     jdbc-type="VARCHAR" />

</class-descriptor>

<class-descriptor class="item.concreteItems.Book" table="items_books">
    <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl" />

    <field-descriptor
                     name="itemCode"
                     column="fk_item_code"
                     jdbc-type="INTEGER"
                     primarykey="true" />    
    <field-descriptor
                     name="isbn"
                     column="isbn"
                     jdbc-type="VARCHAR" />
    <field-descriptor
                     name="author"
                     column="author"
                     jdbc-type="VARCHAR" />
    <field-descriptor
                     name="publisher"
                     column="publisher"
                     jdbc-type="VARCHAR" />
    
    <reference-descriptor name="super" class-ref="item.Item"
        auto-retrieve="true"
        auto-update="true"
        auto-delete="true"
    >
        <foreignkey field-ref="itemCode" />
    </reference-descriptor>
</class-descriptor>
--------------------------------------------------
but when doing a query by Criteria: new QueryByCriteria(Item.class);
I DO not get the "books" as book > instead they are just items :(
I also used in the item mapping "extends" but this did not solve my problem...

It would be very nice if someone could tell me where my problem is.

thanks in advance,
stefan walkner

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic