[prev in list] [next in list] [prev in thread] [next in thread]
List: ojb-user
Subject: OJB - Inheritance - Class>Table Mapping
From: Stefan Walkner <walkner.stefan () sbg ! at>
Date: 2005-03-25 16:06:43
Message-ID: 200503251706.43843.walkner.stefan () sbg ! at
[Download RAW message or body]
Hello,
I would like to map an extended class to a table and a "parent" table.
This means:
I have following classes:
Item
SpecialItem extends Book
and following tables:
items
items_specialitem
IMHO the advantage of this structure is that the items_specialitem "extends"
the items table and I don't have duplicated attributes in the tables. the
"items_specialitem" has a fk_item which should be a foreign key to the items
table.
so I setted up following mappings:
==================================
<class-descriptor class="item.Item" table="items">
<object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl" />
<field-descriptor
name="id"
column="pk_item"
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.Book" table="items_books">
<object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl" />
<extent-class class-ref="item.Item"/>
<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"
/>
<!-- foreign key -->
<reference-descriptor name="id" class-ref="item.Item"
auto-retrieve="true"
auto-update="true"
auto-delete="true">
<foreignkey field-ref="fk_item"/>
</reference-descriptor>
</class-descriptor>
==================================
But this won't work.
The aim is to make a store transaction of a specialitem and this transaction
should insert/udate/delete automagically the items and items_specialitem
table.
I did not find a working solution via google (I just read this model is not
supported by OJB??)
It would be very nice if someone could give me some hints how this could be
realized...
If you need further information about classes/tables/configs - please let me
know.
Thx 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