db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Axel Hohaus" <axel.hoh...@armax.de>
Subject Unique key constraint violations with M-to-N Mapping
Date Mon, 08 Mar 2004 14:41:00 GMT
Hi all,

we have problems saving m:n relations. We get constraint violations.
Have a look at ojb-user list entry written by Peter Wieland.
I've changed code in the method storeCollectionObject of
PersistenceBrokerImpl. Now it works fine.
There is a comment describing problems with FK violation using m:n
relations with autoupdate. I think this problem exists without
autoupdate too.

Please have a look at my changes and check it in the cvs head, if it is
a bug. I used the method getMtoNImplementor outside the if
(cds.getCascadeStore()) statement.

        if (cds.isMtoNRelation())
            if (cds.getCascadeStore())
                // 1. Store depended upon object first to avoid FK
             // BRJ: store could have inserted MtoNImplementors
             // so we need to read them to avoid ref. integrity
             // violations
             currentMtoNKeys = mtoNBroker.getMtoNImplementor(cds, obj);

            // 2. Store indirection record
            // BRJ: this could cause integrity problems because
            // obj may not be stored depending on auto-update
            mtoNBroker.storeMtoNImplementor(cds, obj, otherObj,



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

View raw message