Re: [Wonder-disc] WODev "PK on Insert" code causes D2W(onder) problem
Re: [Wonder-disc] WODev "PK on Insert" code causes D2W(onder) problem
- Subject: Re: [Wonder-disc] WODev "PK on Insert" code causes D2W(onder) problem
- From: Ashley Aitken <email@hidden>
- Date: Tue, 27 Apr 2004 23:30:08 +0800
Hi Pierre (et al.),
Thanks for your post (and your code ;-).
On 27/04/2004, at 11:00 PM, email@hidden wrote:
There might be code out there that from the fact an object has a
permanent globalID (EOKeyGlobalID) concludes that the object ma be
found in the database ...
With WOnder being open source you should be able to sport such code
and ammend.
I found this in my (a month old) Project WONDER source for
ERXExtensions.java:
public static boolean isNewObject(EOEnterpriseObject eo) {
if (eo.editingContext() == null) return true;
EOGlobalID gid = eo.editingContext().globalIDForObject(eo);
return gid.isTemporary();
}
I don't call this explicitly, but perhaps the Wonder page I use does.
I guess my objects should still be thought of as "new" but since it
no-longer has a temporary GID, this code would imply it is not.
I note that the comment for this code:
/**
* Tests if an enterprise object is a new object by
* looking to see if it is in the list of inserted
* objects for the editing context or if the editing
* context is null.<br/>
* <br/>
* Note: An object that has been deleted will have it's
* editing context set to null which means this method
* would report true for an object that has been deleted
* from the database.
* @param eo enterprise object to check
* @return true or false depending on if the object is a
* new object.
*/
It suggests it is "checking if the object is in the list of inserted
objects for the editing context." As shown above, it doesn't seem to
do this.
By "inserted objects" I assume this meant, newly inserted objects,
scheduled to be saved to the database, as opposed to any old object in
the EC.
Should/could I change this code to check if the object is in the list
of "new" objects for the EC? Do you think this would help?
Cheers,
Ashley.
--
Ashley Aitken
Perth, Western Australia
mrhatken at mac dot com
_______________________________________________
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.