currently there is <subclass>, but no <superclass>?

in table-per-class-hierarchy model we can define subclass inside  parent
class with different discriminator-values, but it's more nature in OO design
that 'extend' a class, that means parent class do not need to know how many
subclasses have been added.

for example, I have an order table,and I use a 'type' discriminator column
to indicate different kind of orders, such as 'normal order','discount
order', and they may have differents in calculating price.

So ,currently  when a new order type was introduced, I need to find the
origional hbm file and add a new "<subclass>" tag. If the code already been
froze (may publish as a jar ), things will be more trouble to extend
existing class.

I think if we have a new  tag to hbm file, life will be easier:

<class name="Order"
        table="parent"
        discriminator-value="0">
    <id name="id">.....</id>
    <discriminator column="type" type="int"/>
    <property ...../>
    ...
</class>

...

<class name="ChristmasDiscountOrder"
        table="order">
    <id name="id">.....</id>
    <superclass name="Order" discriminator-value="15">
</class>

Any comments? maybe this function already there but I can't find it out.

Xiaogang Cao




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to