Re: can Cayenne handle an inheritance model like this?...

From: Robert Zeigler (robert.zeigle..oxanemy.com)
Date: Thu Apr 01 2010 - 12:04:58 EDT

  • Next message: Summers, John1 : "RE: can Cayenne handle an inheritance model like this?..."

    How do you ensure that you don't wind up with duplicated LINKID values? Eg,
    if TRADE.ID assigned based on the value of LINKID, or is LINKID assigned
    based on the value of TRADE.ID and/or INSTR.ID?

    Robert

    On Thu, Apr 1, 2010 at 10:49 AM, Summers, John1 <john1.summer..iti.com>wrote:

    > Hello Apache-Cayenne users,
    >
    > I am engaged on a project where we are trying to replace a messy bespoke
    > Data Access Layer with a more modern ORM framework. We have been looking at
    > Hibernate but it cannot handle our inheritance model. I would like to ask if
    > Cayenne can handle such a model because if it can we will continue and make
    > a full assessmet of Cayenne. I will describe the model to you now:
    >
    > Ok the database tables look like this:
    >
    > BASEENTITY
    > -ID
    > -LINKID
    >
    > TRADE
    > -ID
    >
    > INSTR
    > -ID
    >
    > And the Java object hierarchy is that BaseEntity is the superclass with
    > Trade and Instr (and others) as the subclass.
    >
    > Here's the rub...
    >
    > The ID fields on the 3 tables do NOT express a hierarchy. They are unique
    > to each table only. You cannot look up a Trade's BaseEntity by using the
    > trade ID and finding a matching LINKID in BaseEntity.
    >
    > The connection is actually the BASEENTITY.LINKID field. The LINKID matches
    > IDs in the TRADE or INSTR table. Like this:
    >
    > BASEENTITY
    > ID=1, LINKID=100
    > ID=2, LINKID=200
    >
    > TRADE
    > ID=100
    >
    > INSTR
    > ID=200
    >
    > Hibernate cannot handle this. Unidirectional one to one relationships
    > require annotation on each end. The 'table per class' inheritance model
    > requires the ID fields in TRADE and INSTR to be foreign keys of BASEENTITY,
    > which they are not.
    >
    > Look forward to any advice.
    > Thanks,
    > John
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Apr 01 2010 - 12:05:35 EDT