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: Fri, 20 Jul 2007 07:24:16 -0500
On Jul 19, 2007, at 11:00 PM, Chuck Hill wrote:
Odd, I did not get the original message...
On Jul 19, 2007, at 8:38 PM, David Avendasora wrote:
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.
I have seen problems in the past where EOF needs to fire a fault in
a to-many relationship when processing a deletion. That totally
hosed the EOF state. I don't recall if that has been fixed or not,
I still have my fix in place (fired all affected faults before
saving).
So, where can I get this fix of yours? :)
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.
Much with Own Destination and to-many relationships makes no
sense / is not intuitive.
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.
I should clarify this _some_. I'm using D2JC, and it is the Form
screen of the Tool entity, which shows a scrolling list of the
related ToolConfigurations. When I select a ToolConfiguration and
click the "Remove" button, the ToolConfiguration is removed from the
list just as you'd expect, but when I save the Tool, I get a pop-up
dialog box stating that the "Tool" relationship is required. I know
this will have meaning to maybe 1/2 of 1% of WO Devs out there, but
hey, gotta try...
Why would EOF try to update an Object it was going to delete?
It might have confused state. Or, maybe, you have told it to.
I have several relationships in other Entities that are setup
exactly the same, yet they don't have any problems deleting
related toMany objects.
Then they can't be exactly the same. Have you checked to see if
the delete rules on the two relationships are the same? Have a
Nullify in there somewhere?
Identical. Every option is set the same on this relationship (both
directions) and their associated attributes (PKs and FKs) as several
other similar relationships. The others all work without a problem.
Chuck
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:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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