RE: DbMerger and relationships

From: Scott Anderson (sanderso..irvana.com)
Date: Thu Oct 02 2008 - 15:35:08 EDT

  • Next message: Dave Dombrosky: "Getting unmapped PK using EJBQL"

    I think the problem is that there exists a delete rule something like:
    mail.sentfrom REFERENCES account (id) ON DELETE SET NULL

    And, for some reason, adding another relationship,
    mail.sentto REFERENCES account (id) [presumably, ON DELETE CASCADE]
    causes some kind of internal struggle in Derby.

    Now that I'm thinking about it more, maybe this is a Derby issue.

    -----Original Message-----
    From: Andrey Razumovsky [mailto:razumovsky.andre..mail.com]
    Sent: Thursday, October 02, 2008 2:22 PM
    To: use..ayenne.apache.org
    Subject: Re: DbMerger and relationships

    I'm not sure about merging, but we're not using delete rules at reverse
    engineering, so I think merger isn't checking them too. If you ask about
    plain JDBC, of course getting rules is possible. You should start at
    Connection.getMetaData().getImportedKeys(...) and then use
    ResultSet.getInt("UPDATE_RULE") or ResultSet.getInt("DELETE_RULE") and
    fetched result set.
    Could you tell some more about your situation, for error message doesn't
    seem to describe it properly.

    BTW, I'd be very cautious with setting delete rules both in DB and
    Cayenne.
    In most cases Cayenne rule is enough i think

    2008/10/2, Scott Anderson <sanderso..irvana.com>:
    >
    > Does anyone know if it's possible to get information about existing
    > relationships' UPDATE/DELETE rules via JDBC? Looks like the DELETE
    rule on
    > my Derby database isn't in sync with what Cayenne thinks it is, but
    the
    > merger isn't checking that.
    >
    > Foreign Key 'SQL081001165758000' is invalid because 'The table cannot
    be
    > defined as a dependent of table APP.ACCOUNT because of delete rule
    > restrictions. (The relationship causes the table to be
    delete-connected to
    > the indicated table through multiple relationships and the delete rule
    of
    > the existing relationship is SET NULL.). '.
    > ALTER TABLE mail ADD FOREIGN KEY (sentto) REFERENCES account (id)
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Oct 02 2008 - 15:35:42 EDT