Re: Problem with deleting a related object (to-many relationship)
Re: Problem with deleting a related object (to-many relationship)
- Subject: Re: Problem with deleting a related object (to-many relationship)
- From: David Avendasora <email@hidden>
- Date: Thu, 19 Jul 2007 22:38:54 -0500
Hi all,
This is very odd. Apparently yes, EOF is trying to update the
ToolConfiguration prior to deleting it, which is causing it to error.
What is odd also is that if I try to delete the Tool, I get the same
error since it is trying to remove the Tool from the
ToolConfigurations when it should just delete the ToolConfigurations
straight-out.
If I make the relationship Optional, even though the inverse is
marked as Owns Desitination, it works just fine. How can Tool "own"
the related ToolConfigurations, but the Tool relationship of
ToolConfiguration be "Optional"? That just makes no sense.
This is a Java Client application and it is the client-side that is
generating the warning. It's not actually an error (nothing in any of
the logs), WO's built-in validation is catching that the relationship
is required log before the changes to the EditingContext are being
sent back to the Server to be saved. I'm using project Wonder's new
SQLServer Ordering and I know it is never getting that far due to all
the logging I have enabled.
Why would EOF try to update an Object it was going to delete? I have
several relationships in other Entities that are setup exactly the
same, yet they don't have any problems deleting related toMany objects.
Dave
On Jun 9, 2007, at 4:54 AM, Florijan Stamenkovic wrote:
Hi David,
It sounds as if EOF is first trying to update the change of
relationship, before processing the deletion caused by your "Owns
Destination". You might be able to test this by setting the "tool"
relationship to optional, and trying the same thing again. However,
this would be quite silly from EOF to do, as it is not unreasonable
to assume that an object (toolConfig) which is owned by another
(tool) has a mandatory relationship towards the relationship owner.
This is not based on experience, just thinking out loud.
Cheers,
F
Hi all,
I have the following relationship: Tool <-->> ToolConfiguration.
- Optionality for the "tool" relationship in ToolConfiguration is
"Mandatory"
- Optionality for the "toolConfigurations" relationship of Tool is
"Optional"
- "Owns Destination" is checked for the "toolConfigurations"
relationship of Tool
When I remove a toolConfiguration from the toMany relationship and
save, I get an error stating "Save Failed: Relationship tool must
have a Tool!"
By having the "Owns Destination" checked on the
"toolConfigurations" relationship, shouldn't removing a
toolConfiguration from the relationship automatically Delete the
ToolConfiguration object? Am I missing something fundamental?
Thanks,
Dave
P.S. Here's the .plist files for each entity:
{
attributes = (
{columnName = "Is_Active"; name = isActive; prototypeName
= boolean; },
{columnName = "Tool_ID"; name = toolId; prototypeName =
keyId; },
{columnName = "Tool_Name"; name = toolName; prototypeName
= entityName; },
{columnName = "Tool_Type_ID"; name = toolTypeId;
prototypeName = keyId; }
);
attributesUsedForLocking = (isActive, toolTypeId, toolId,
toolName);
className = "com.bestmaid.bakeryManagement.routing.Tool";
classProperties = (
toolConfigurations,
primaryTools,
toolType,
isActive,
secondaryTools,
usedInToolConfigurations,
toolName
);
externalName = "dbo.Tool";
fetchSpecificationDictionary = {};
internalInfo = {
"_clientClassPropertyNames" = (
toolConfigurations,
primaryTools,
toolType,
isActive,
secondaryTools,
usedInToolConfigurations,
toolName
);
"_javaClientClassName" = EOGenericRecord;
"_nameInObjectStore" = "dbo.Work_Center";
uniqueID = 198115770;
};
name = Tool;
primaryKeyAttributes = (toolId);
relationships = (
{
deleteRule = EODeleteRuleDeny;
destination = ToolRelationship;
internalInfo = {"_nameInObjectStore" = primaryTools;
uniqueID = 186092893; };
isToMany = Y;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = secondaryToolId;
sourceAttribute = toolId; });
name = primaryTools;
ownsDestination = Y;
},
{
deleteRule = EODeleteRuleCascade;
destination = ToolRelationship;
internalInfo = {"_nameInObjectStore" = secondaryTools;
uniqueID = 186092845; };
isToMany = Y;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = primaryToolId;
sourceAttribute = toolId; });
name = secondaryTools;
ownsDestination = Y;
},
{
deleteRule = EODeleteRuleCascade;
destination = ToolConfiguration;
isToMany = Y;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = toolId;
sourceAttribute = toolId; });
name = toolConfigurations;
ownsDestination = Y;
},
{
destination = ToolType;
isMandatory = Y;
isToMany = N;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = toolTypeId;
sourceAttribute = toolTypeId; });
name = toolType;
},
{
deleteRule = EODeleteRuleCascade;
destination = ToolConfigurationTool;
internalInfo = {"_nameInObjectStore" =
toolConfigurations; };
isToMany = Y;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = toolId;
sourceAttribute = toolId; });
name = usedInToolConfigurations;
ownsDestination = Y;
}
);
restrictingQualifier = "(toolTypeId = 2)";
userInfo = {fetchSpecificationDictionary = {}; };
}
{
attributes = (
{
columnName = "Breakdown_Time";
name = breakdownTime;
prototypeName = quantity;
},
{
columnName = "Concurrency_Factor";
name = concurrencyFactor;
prototypeName = quantity;
},
{
columnName = "Configuration_Description";
name = configurationDescription;
prototypeName = entityDescription;
},
{
columnName = "Configuration_Instructions";
name = configurationInstructions;
prototypeName = longText;
},
{columnName = "Interval_Time"; name = intervalTime;
prototypeName = quantity; },
{columnName = "Process_Time"; name = processTime;
prototypeName = quantity; },
{
columnName = "Production_Sequence";
name = productionSequence;
prototypeName = quantity;
},
{columnName = "Setup_Time"; name = setupTime;
prototypeName = quantity; },
{
columnName = "Tool_Configuration_ID";
name = toolConfigurationId;
prototypeName = keyId;
},
{columnName = "Tool_ID"; name = toolId; prototypeName =
keyId; }
);
attributesUsedForLocking = (
productionSequence,
toolConfigurationId,
toolId,
configurationDescription,
breakdownTime,
concurrencyFactor,
intervalTime,
processTime,
setupTime
);
className =
"com.bestmaid.bakeryManagement.routing.ToolConfiguration";
classProperties = (
configurationInstructions,
routingSteps,
tool,
routings,
productionSequence,
configurationDescription,
toolsUsed,
breakdownTime,
concurrencyFactor,
intervalTime,
processTime,
setupTime
);
externalName = "dbo.Tool_Configuration";
fetchSpecificationDictionary = {};
internalInfo = {
"_clientClassPropertyNames" = (
configurationInstructions,
routingSteps,
tool,
routings,
productionSequence,
configurationDescription,
tools,
setupTime,
processTime,
intervalTime,
concurrencyFactor,
breakdownTime,
usesTools,
toolsUsed
);
"_javaClientClassName" = EOGenericRecord;
"_nameInObjectStore" = "Tool_Configuration";
uniqueID = 198115577;
};
name = ToolConfiguration;
primaryKeyAttributes = (toolConfigurationId);
relationships = (
{
deleteRule = EODeleteRuleDeny;
destination = RoutingStepToolConfiguration;
internalInfo = {"_nameInObjectStore" = routingSteps;
uniqueID = 198114823; };
isToMany = Y;
joinSemantic = EOInnerJoin;
joins = (
{
destinationAttribute = toolConfigurationId;
sourceAttribute = toolConfigurationId;
}
);
name = routingSteps;
ownsDestination = Y;
},
{
deleteRule = EODeleteRuleDeny;
destination = RoutingToolConfiguration;
isToMany = Y;
joinSemantic = EOInnerJoin;
joins = (
{
destinationAttribute = toolConfigurationId;
sourceAttribute = toolConfigurationId;
}
);
name = routings;
ownsDestination = Y;
},
{
destination = Tool;
internalInfo = {uniqueID = 198114814; };
isMandatory = Y;
isToMany = N;
joinSemantic = EOInnerJoin;
joins = ({destinationAttribute = toolId;
sourceAttribute = toolId; });
name = tool;
},
{
deleteRule = EODeleteRuleCascade;
destination = ToolConfigurationTool;
internalInfo = {"_nameInObjectStore" = tools; };
isToMany = Y;
joinSemantic = EOInnerJoin;
joins = (
{
destinationAttribute = toolConfigurationId;
sourceAttribute = toolConfigurationId;
}
);
name = toolsUsed;
ownsDestination = Y;
}
);
userInfo = {fetchSpecificationDictionary = {}; };
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
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