cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Anderson" <>
Subject RE: DbMerger and relationships
Date Thu, 02 Oct 2008 19:35:08 GMT
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 [] 
Sent: Thursday, October 02, 2008 2:22 PM
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
In most cases Cayenne rule is enough i think

2008/10/2, Scott Anderson <>:
> 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
> merger isn't checking that.
> Foreign  Key 'SQL081001165758000' is invalid because 'The table cannot
> 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
> the existing relationship is SET NULL.).  '.
> ALTER TABLE mail ADD FOREIGN KEY (sentto) REFERENCES account (id)

View raw message