Re : Re : EOGeneralAdaptorException : deleteRowDescribedByQualifierEntity
Re : Re : EOGeneralAdaptorException : deleteRowDescribedByQualifierEntity
- Subject: Re : Re : EOGeneralAdaptorException : deleteRowDescribedByQualifierEntity
- From: Marc-Alexis Côté <email@hidden>
- Date: Mon, 21 Mar 2005 22:19:07 -0500
As per your suggestion, I replaced the
EOClassDescription.createInstanceWithEditingContext() stuff with
EOUtilities.createAndInsertObject(). The exception is still generated
however, so I guess you might have a point about my model. When you say you
want to see the model, I guess you mean Address.plist and Dealer.plist.
----->Dealer.plist:
{
attributes = (
{
columnName = additionalInformation;
name = additionalInformation;
prototypeName = varchar1000;
},
{name = administrativeAddressFid; prototypeName = id; },
{
allowsNull = N;
columnName = contactName;
name = contactName;
prototypeName = varchar100;
},
{
allowsNull = N;
columnName = dealershipName;
name = dealershipName;
prototypeName = varchar100;
},
{
allowsNull = N;
columnName = email;
name = email;
prototypeName = varchar100;
},
{name = entityId; prototypeName = id; },
{columnName = faxNumber; name = faxNumber; prototypeName =
varchar50; },
{
allowsNull = N;
columnName = password;
name = password;
prototypeName = varchar16;
},
{
allowsNull = N;
columnName = phoneNumber;
name = phoneNumber;
prototypeName = varchar50;
},
{name = shippingAddressFid; prototypeName = id; },
{
allowsNull = N;
columnName = username;
name = username;
prototypeName = varchar16;
}
);
attributesUsedForLocking = (
entityId,
username,
password,
email,
dealershipName,
contactName,
phoneNumber,
faxNumber,
additionalInformation,
shippingAddressFid,
administrativeAddressFid
);
className = Dealer;
classProperties = (
username,
password,
email,
dealershipName,
contactName,
phoneNumber,
faxNumber,
additionalInformation,
administrativeAddress,
shippingAddress
);
externalName = Dealer;
name = Dealer;
parent = AbstractUser;
primaryKeyAttributes = (entityId);
relationships = (
{
deleteRule = EODeleteRuleCascade;
destination = Address;
isToMany = N;
joinSemantic = EOInnerJoin;
joins = (
{destinationAttribute = entityId; sourceAttribute =
administrativeAddressFid; }
);
name = administrativeAddress;
},
{
deleteRule = EODeleteRuleCascade;
destination = Address;
isToMany = N;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = entityId; sourceAttribute =
shippingAddressFid; });
name = shippingAddress;
}
);
}
<-----Dealer.plist
----->Address.plist
{
attributes = (
{
allowsNull = N;
columnName = address1;
name = address1;
prototypeName = varchar100;
},
{columnName = address2; name = address2; prototypeName = varchar100;
},
{allowsNull = N; columnName = city; name = city; prototypeName =
varchar50; },
{name = countryFid; prototypeName = id; },
{name = entityId; prototypeName = id; },
{
allowsNull = N;
columnName = postalCode;
name = postalCode;
prototypeName = varchar16;
},
{name = stateFid; prototypeName = id; }
);
attributesUsedForLocking = (entityId, address1, address2, city,
stateFid, postalCode, countryFid);
className = Address;
classProperties = (address1, address2, city, postalCode, country,
state);
externalName = Address;
fetchSpecificationDictionary = {};
name = Address;
primaryKeyAttributes = (entityId);
relationships = (
{
destination = Country;
isToMany = N;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = entityId; sourceAttribute =
countryFid; });
name = country;
},
{
destination = State;
isToMany = N;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = entityId; sourceAttribute =
stateFid; });
name = state;
}
);
}
<-----Address.plist
Regarding EOClassDescription.createInstanceWithEditingContext(), I saw that
in the code from project Wonder. Is this a bad way to do things? I noticed
that if I create an object this way, and I call ec.saveChanges(), then the
object is not inserted into the database (unless I explicitly call
ec.insertObject())
Thanks,
Marc-Alexis
Le 21/03/05 19:20, « Christian Pekeler » <email@hidden> a écrit :
>> When the application is restarted and a dealer is deleted, one of it's
>> two
>> addresses are deleted. I have checked the eomodel, and the
>> relationships
>> seem to be pointing at the right place.
>
> I think there might be something wrong in your model. Can we see it?
>
>
>> Note that in my previous example, I
>> was incorrectly using addToBothSidesOfRelationshipWithKey and
>> removeObjectFrom... when the relationships were unidirectional.
>
> That's OK, those methods can deal with unidirectional relationships.
>
>
>> Address shippingAddress =
>> (Address)addressDescription.
>> createInstanceWithEditingContext(ec, null);
>> ec.insertObject(shippingAddress);
>
> EOClassDescription.createInstanceWithEditingContext() is already
> inserting the object into the editing context. I suggest you take out
> all that class description stuff and either use
>
> Address shippingAddress = new Address();
> ec.insertObject(shippingAddress);
>
> or
> Address shippingAddress =
> (Address)EOUtilities.createAndInsertObject(ec, "Address");
>
>
> Christian
>
>
_______________________________________________
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