Re: D2W EditToOne relationship question
Re: D2W EditToOne relationship question
- Subject: Re: D2W EditToOne relationship question
- From: Chuck Hill <email@hidden>
- Date: Tue, 8 Mar 2005 10:06:02 -0800
Problems arise when I try to edit an existing "Merchandise" instance
and update it with a new "Thumbnail" instance. It can't be done! The
framework keeps trying to save NULL for the primary key of the new
Thumbnail instance and therefore rejects the request to save changes.
How are you doing this? It sounds like there are _two_ Thumbnail
instances in the editing context. Try logging out
ec.insertedObjects(), ec.updatedObjects(), and ec.deletedObjects(). In
the case of owned relationships, EOF manages object creation for you.
I suspect that you are duplicating its work somewhere.
Chuck
On Mar 7, 2005, at 8:41 PM, Aaron Rosenzweig wrote:
Hello Everyone,
=== Problem Description: ===
I want to connect two tables with a Mandatory and Owned To-One
relationship where I propagate the primary key of the main table to
the subordinate table. That's a mouthful! More concretely, I have a
"Merchandise" table which contains information about price, shipping,
title, summary, etc. I want to have a "Thumbnail" image of a
particular merchandise but I don't want it stored as a column of the
"Merchandise" table. I don't always need to show the Thumbnail in my
application so I want to load that image "on demand" only when it is
needed. This saves memory and traffic to the database. So… I set up
"Merchandise" and "Thumbnail" in EOModeler like this:
"Merchandise":
1) Mandatory
2) Owns Destination
3) Propagate Primary Key
4) Cascades on delete
"Thumbnail":
1) Mandatory
2) nullifies on delete (I also tried the option to do nothing on
delete).
This is exactly like the classic "Movies" EOModel file Apple ships as
an example. They do the same thing with the "Talent" and "TalentPhoto"
tables.
=== D2W Limitation Description: ===
Maybe I'm just overlooking something, but for the past 7 days I have
been trying to get my basic D2W project to work. I can create a new
"Merchandise" entity and a new "Thumbnail" image just fine. This saves
to the database and works perfectly.
Problems arise when I try to edit an existing "Merchandise" instance
and update it with a new "Thumbnail" instance. It can't be done! The
framework keeps trying to save NULL for the primary key of the new
Thumbnail instance and therefore rejects the request to save changes.
=== Shred of Hope ===
I really want to work "with" WebObjects, not against it because "it
will win" - or so I've heard. I believe making custom "Property Level"
components best leverages the dynamic nature of D2W. I don't want to
freeze a page and do some clever hacking to try to get this case to
work.
I started poking around in "Project WOnder" and found
ERDEditOwnedRelationship and ERD2WTwoLevelEditToOneRelationship which
might do what I want, but they seem quite complex and I don't
understand the options that show up in the D2W configuration applet
when I select these relationships.
Thanks in advance,
-- Aaron
Author of the "Old Fart's Guide" series
http://www.cocoanutstech.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development 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