Behavior of ERXGenericRecord.isNewObject

Daniele Corti <[email protected]>
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <CAJh8f28rpZCoL+0oHiu0r=DZG95DOz_xBPxW4igRkdKKc8d_1A@mail.gmail.com>
Hi,
I've a little doubt about the behavior of ERXGenericRecord.isNewObject.

I create some objects that, simply, check, using the Validity framework,
the consistency of constraints (not null, unique, etc) when the
editingContext save them to the DB. The ValidityException is showed to the
user if there is an error.

When I create a new Object, I insert it in the editingContext when I fire
the save method, not before.

In order to show a sign to the user that say "New Object" or "Edit Object"
in the Object Form, I call the isNewObject() method to check if the object
is new or is inside the DB.

The problem occurs when a Validity Exception is thrown and the Object is
not saved to the DB. The error is correctly showed to the user, but
the isNewObject() method return false, even if the object is not saved to
the DB.

Maybe I've misunderstood the behavior of the method isNewObject, but the
Documentation of ERXEOControlUtilities.isNewObject(EOEnterpriseObject
eo) method (called by ERXGenericRecord.isNewObject() method) say:

Determines if an enterprise object is a new object and  hasn't been saved
to the database yet.
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.

So, I think that my workflow should work.

Thanks for any help
-- 
Daniele Corti
--
I DON'T DoubleClick

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct

_______________________________________________
Wonder-disc mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wonder-disc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.