Re: Behavior of ERXGenericRecord.isNewObject
Daniele Corti <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.wonder-disc |
|---|---|
| Message-ID | <CAJh8f2-DU_7ws-oCrJK5WCy35XUVjFVSR2uoGosqvy1vaPUGAQ@mail.gmail.com> |
It seems that I was using wo:ERXNonNullConditional and not wo:WOConditional to check the new object, so the check was uncorrect. My fault... 2012/10/18 Daniele Corti <[email protected]> > 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 > > -- 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