You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Rhys Parsons <rh...@causeway.com> on 2003/12/10 11:53:51 UTC

Collections on base class.





Hi,

I have three classes extended from a base class.  The base abstract class
is Item.  The three subclasses are PricedItem, CompositeItem and TextItem.

I also have a Contract class which contains a collection of Items.

I have mapped the PricedItem, CompositeItem and TextItem classes to one
table called ITEM.  The mapping for Contract contains the following:

        <collection-descriptor
            name="items"
            element-class-ref="com.causeway.valuations.data.Item"
            orderby="position"
            sort="DESC"
        >
            <inverse-foreignkey field-ref="owningCompositeId"/>
        </collection-descriptor>

Initially I only had a single field descriptor in Item for the contractId,
but have added identical descriptors for each of the subclasses too.
However, on examining the ITEM table, I find that in the first case, the
CONTRACT_ID field is NULL; and in the second case it contains the value 0.
However, the contract actually has the ID 1.

All other references and collections are working correctly, so I'm guessing
that this is to do with referencing a base class.

So, is there actually a way of mapping a collection to a base class in this
way?

If anyone could help me, that would be great!

Cheers!

Rhys Parsons


Causeway Technologies Limited
Tel:    (+44 (0)1628 552000)
Fax:    (+44 (0)1628 552001)
http://www.causeway.com

Disclaimer Notice :-

The message and any attachments contained in this e-mail are intended for
the named recipient(s) only.  It may contain privileged or confidential
information or information which is exempt from disclosure under the
applicable laws.  If you are not the intended recipient(s), you must not
read, print, retain, copy distribute, forward or take any or refrain form
taking any action in reliance on it or any of its attachments.  If you have
received or have been forwarded this e-mail in error, please notify us
immediately by return e-mail or telephone (+44(0)1628 552088) and delete
this message from the computer or any other data-reading device in its
entirety.

Please advise us immediately if you do not or your employer does not
consent to Internet e-mail for messages of this nature.

Internet communications cannot be guaranteed to be secure and error-free as
the information could be intercepted, corrupted, lost, arrive late or
contain viruses.  The sender and this Company therefore do not and shall
not accept any liability or responsibility of whatsoever nature in the
context of this message and its attachment(s) which arises as a result of
Internet transmission.  Opinions, conclusion, representations, views and
such other information in this message that do not relate to the official
business of this Company shall be understood as neither given nor endorsed
by it.


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