deleteSelection sets relationship null rather than deleting
deleteSelection sets relationship null rather than deleting
- Subject: deleteSelection sets relationship null rather than deleting
- From: Ian Joyner <email@hidden>
- Date: Tue, 4 Oct 2005 16:11:56 +1000
I have a reflexive many-to-many contacts relationship modelled, as
you would expect through a join table. The entity is defined as follows:
attributes:
primary_key not null
relationship: string
contact_key not null
owner_key not null
relationships:
contact: contact_key -> Person.primary_key (optional) on delete, nullify
owner: owner_key -> Person.primary_key (optional) on delete, nullify
When I use deleteSelection this record is not deleted from the join
table, but rather updated, setting the owner_key to null, which the
database does not like. If I remove the not null from owner_key, the
owner_key is set to null, but the record not deleted. I have also
tried on delete, no action.
[2005-10-04 15:38:38 EST] <WorkerThread5> evaluateExpression:
<com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression:
"UPDATE PERSON_CONTACT SET OWNER_KEY = NULL WHERE (PRIMARY_KEY = ?
AND OWNER_KEY = ? AND CONTACT_KEY = ? AND RELATIONSHIP is NULL)"
withBindings: 1:19(primary_key), 2:249(owner_key), 3:521(contact_key)>
Server exception: EvaluateExpression failed:
<com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression:
"UPDATE PERSON_CONTACT SET OWNER_KEY = NULL WHERE (PRIMARY_KEY = ?
AND OWNER_KEY = ? AND CONTACT_KEY = ? AND RELATIONSHIP = ?)"
withBindings: 1:14(primary_key), 2:408(owner_key), 3:466
(contact_key), 4:"Sister"(relationship)>:
Next exception:SQL State:42000 -- error code: 0 -- msg: ERROR -
Value can not be NULL for column 'OWNER_KEY'
SQL: UPDATE PERSON_CONTACT SET OWNER_KEY = NULL WHERE (PRIMARY_KEY =
14 AND OWNER_KEY = 408 AND CONTACT_KEY = 466 AND RELATIONSHIP =
'Sister')
Person has a one-to-many relationship 'contacts', which has on
delete, cascade (since I want the join table record removed, but not
the contact). It also has 'owns destination'.
The strange thing is that I have exactly the same set up between
other tables (members and doctors and managers), and deleting these
contacts works fine.
Can anyone think of why EO wants to update the relationship rather
than delete the record?
Thanks
Ian Joyner
Sportstec
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden