Correction. While my earlier advise on "dep PK" flag still stands, the
error is likely due to misconfigured delete rules.
On Feb 5, 2004, at 11:49 AM, Andrus Adamchik wrote:
> aContext.deleteObject(user);
> aContext.commitChanges();
Looking at this one more time, I am pretty sure that the error happens
here, not on insert. To fix the failure you either need to set a
NULLIFY delete rule for this ObjRelationship, or manually unset the
relationship before deleting an object:
> <obj-relationship name="Roles" source="User" target="Role"
> toMany="true">
> <db-relationship-ref source="user" target="userroles"
> name="userrolesArray"/>
> <db-relationship-ref source="userroles" target="role"
> name="torole"/>
> </obj-relationship>
An explanation of delete rules can be found here:
http://objectstyle.org/cayenne/modelerguide/modeling-object-layer/
delete-rules.html
Andrus
This archive was generated by hypermail 2.0.0 : Thu Feb 05 2004 - 11:59:46 EST