Re: Duplicate record
Re: Duplicate record
- Subject: Re: Duplicate record
- From: "A. Uchida" <email@hidden>
- Date: Fri, 23 Jul 2004 01:08:59 +0100
Dear Nathan,
Thank you very much for your message. But otherwise I don't want to
delete any records actually.
I want to keep old record which might be related to another table. But
I don't want to duplicate
the relationship.
Im making a quote database.
When a quote record is produced product data are going to be picked up
from Product table.
But Product detail (price or description of a product) will be changed
case by case or in the future
but the old quote record which had been already created should not be
updated by the modification.
So I tried to keep the record as it is.
I was afraid that I should use a middle table only to keep the detail
of product
(duplicate records from Product to the middle table and middle table
has to one relationship to Quote).
But I thought it isn't a clever way, because the size of the middle
table will be very big.
However, I used a middle table between Product and Quote to hold only
the relationship to
quote records, price of quote (currency can be changed often),
discount...etc.
Basic description, specifications are not copied from Product to the
middle table.
I am not sure it is the best way, though.
Quote < one to many >> mid table (a quote can have multiple
products)
mid table << many to one > Product (a product can be used in
multiple quote)
If you can give me some advises, it would be great.
Thanks again.
Regards,
Atsushi Uchida
On 22 Jul 2004, at 23:36, Nathan Dumar wrote:
Going back to the original question/problem and re-reading it, I'm
wondering why you're trying to create a duplicate of the record.
You want to modify the record, but keep it from being modified?
If you fetch the record and modify its attributes, but you don't
specifically modify it's relationship to other objects, all of the
references to other objects will stay the same. For example, if you
have a restaurant object with a to-many relationship to 5 chef
objects, you can change the name of the restaurant, the address, etc,
and it will still have references to the same 5 chefs as before. That
will not change unless you specifically assign a new array of chef
objects to the restaurant's chef relationship attribute, or you set a
different restaurant in a chef's restaurant relationship attribute.
(Now did that sound confusing or what?)
If you're worried about the record being deleted, and other objects
trying to refer to a deleted object, then you can set how such a
deletion should be handled, using the Delete Rule. You can set the
Delete Rule using the Advanced Relationship Inspector, in EOModeler.
Here's the description of Delete Rule options, from the document Using
EOModeler:
http://developer.apple.com/documentation/WebObjects/UsingEOModeler/
5WorkingWithRelationships/chapter_5_section_5.html#//apple_ref/doc/
uid/TP30001018-DontLinkChapterID_4-BABCCJCI
I hope that helps.
Nathan
On Jul 20, 2004, at 6:03 PM, A. Uchida wrote:
Hi there,
WO 5.2
Mac OS X10.3.4
Postgresql7.3.4 (pg73jdbc.jar)
When modifying an existing record in a table I want to keep the
existing record as it is,
because it might be used (relationed) to the other records in the
other table.
What I've tried was :
Show details of a record which is going to be modified
Insert new object into the table
Copy the details of record to the inserted object
and saveChanges()
But it gets primary key duplication error.
And I tried search on web/mailing list but I couldn't find any clue.
I even doesn't know what would be the keyword for search this issue.
Any help would be very much appreciated.
A. Uchida
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.