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

From: Summers, John1 (john1.summer..iti.com)
Date: Thu Apr 01 2010 - 11:49:33 EDT

  • Next message: Robert Zeigler: "Re: can Cayenne handle an inheritance model like this?..."

    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 - 11:51:17 EDT