Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread Ken Anderson
If your model is setup to cascade delete the relationship, it should.On May 3, 2006, at 5:52 PM, WebObjects wrote: David and others, thanks s much.  Here is the winner: if (donor.entityName().equals("TblDonor")) { String tempLName = (String)

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread WebObjects
Title: Re: Want to iterate over items in EditingContext for validation before save David and others, thanks s much.  Here is the winner: if (donor.entityName().equals("TblDonor")) { String tempLName = (String)donor.v

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread David LeBer
On 3-May-06, at 5:34 PM, WebObjects wrote: I can't seem to get around java.lang.ClassCastException I know the EO's are of a known type, and using System.out.println ("Here is entity name: " + myObjectToTest.entityName()); ...but when I try to use "myObjectToTest.strLastName()" to access th

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread Mark Morris
Hi Bill,It might be interesting to also print donor.getClass().getName().-- MarkOn May 3, 2006, at 4:34 PM, WebObjects wrote: I can't seem to get around java.lang.ClassCastException I know the EO's are of a known type, and using System.out.println("Here is entity name: " + myObjectToTest.entityNam

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread WebObjects
Title: Re: Want to iterate over items in EditingContext for validation before save I can't seem to get around java.lang.ClassCastException I know the EO's are of a known type, and using System.out.println("Here is entity name: " + myObjectToTest.entityName()); ...b

RE: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread Randy Wigginton
Personally I would suggest snapshot - returns a handy-dandy dictionary of the item. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WebObjects Sent: Wednesday, May 03, 2006 4:55 PM To: WebObjects-List Apple Subject: Re: Want to iterate over items in

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread Ken Anderson
Bill, Are you only interested in one kind of EO to possibly delete? Why not check the eo's entityName(), and if it's the one you want, cast it to the right type and just send the correct methods? IE: if (myObjectToTest.entityName().equals("Item")) { Item item = (Item) myObjectToTe

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread WebObjects
I'm taking a poke at using "ec.insertedObjects()" to evaluate each object prior to saving. So far I can grab an array of the objects, although I had to cast them into EO's and not simply their entity type (code immediately following): NSArray tester = new NSArray(ec.insertedObjects());

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread Ken Anderson
Kieran, Agreed - the reason these suggestions were made is because he specifically stated that it's too late to change. Ken On May 3, 2006, at 9:57 AM, Kieran Kelleher wrote: Stop! .. here is the easy way.. ;-) As per Apple WWDC sessions NEVER, EVER use the page constructor

Re: Want to iterate over items in EditingContext for validation before save

2006-05-03 Thread Kieran Kelleher
Stop! .. here is the easy way.. ;-) As per Apple WWDC sessions NEVER, EVER use the page constructor for creating EOEnterpriseObjects (or anything else for that matter). Use lazy initialization to create, fetch and pull in data "as required, on demand". Then you don't ever have

Re: Want to iterate over items in EditingContext for validation before save

2006-05-02 Thread Art Isbell
On May 2, 2006, at 4:01 PM, WebObjects wrote: If I were to remove an element of the NSArray returned by this method, would then calling .saveChanges() on the ec now exclude objects removed from the array? If so is this because of the magic of WO keeping track of things? EOEditingContext

Re: Want to iterate over items in EditingContext for validation before save

2006-05-02 Thread Ken Anderson
No, but doing ec.deleteObject(obj) will. If the object is new and has never been saved, it will effectively be nullified. On May 2, 2006, at 10:01 PM, WebObjects wrote: Art, I'm thinking of EOEditingContext.insertedObjects() as the choice in this case. I actually thought that may be the

Re: Want to iterate over items in EditingContext for validation before save

2006-05-02 Thread WebObjects
Art, I'm thinking of EOEditingContext.insertedObjects() as the choice in this case. I actually thought that may be the answer here (thanks for your time on this). If I were to remove an element of the NSArray returned by this method, would then calling .saveChanges() on the ec now exclude object

Re: Want to iterate over items in EditingContext for validation before save

2006-05-02 Thread Art Isbell
On May 2, 2006, at 2:48 PM, WebObjects wrote: I've found an error in my coding style - too late in this project though. I use EOUtilities.createAndInsertInstance in a constructor for a page, and as a result 'refresh' and 'back' have become my enemies. How can I iterated over the unsaved ob

Want to iterate over items in EditingContext for validation before save

2006-05-02 Thread WebObjects
I've found an error in my coding style - too late in this project though. I use EOUtilities.createAndInsertInstance in a constructor for a page, and as a result 'refresh' and 'back' have become my enemies. How can I iterated over the unsaved objects in an EditingContext (ec), test their validity