Strange EO issue
Strange EO issue
- Subject: Strange EO issue
- From: Andrew Kinnie <email@hidden>
- Date: Tue, 14 Dec 2004 15:59:39 -0500
In my never ending quest to add basic functionality to an existing site, I seem to now be having EO issues.
My database has a table called BOOKING which has as its Entity name "Booking" and class "Booking" and this has been the case since the site was first deployed 2 years ago.
We added a new location to the company, and as part of this, I added a table to the EOModel and executed the SQL to create the table in the database. The new table is called GENEVA_BOOKING, the entity is called GenevaBooking, and the class is still Booking. I added a column to a table on the site to allow administrative users to add bookings for the new location.
They do this via a form, adding the Bookings as objects in NSMutableArrays called bookingList and genevaBookingList, These lists are populated in Session's constructor as follows:
ec = defaultEditingContext();
bookingList = new NSMutableArray(EOUtilities.objectsForEntityNamed(ec,"Booking"));
genevaBookingList = new NSMutableArray(EOUtilities.objectsForEntityNamed(ec,"GenevaBooking"));
On the admin page I add new bookings like this:
if(! editingObject) { // this line works
if(clubNumber == 1){ // first club selected
System.out.println("newBooking is: " + newBooking + " before bookingList is updated it is: " + s.bookingList); // this works
s.bookingList.addObject(newBooking);
System.out.println("after bookingList is updated it is: " + s.bookingList); // this works
s.sortObjects(s.bookingList);
} else { // second club selected
System.out.println("If I was adding a booking to the first table, I shouldn't have gotten here.");
s.genevaBookingList.addObject(newBooking);
s.sortObjects(s.genevaBookingList);
}
ec.insertObject(newBooking);
}
// Need to save new info here
ec.saveChanges(); // this seems to always add the new bookings into the GENEVA_BOOKING table
The problem is that the code seems to always add new Booking objects into the GENEVA_BOOKING table, regardless of the club number, or whether the object is added to bookingList or genevaBookingList. The run log shows it is adding it to GENEVA_BOOKING, and this is what happens. I have tried as many things as I can think of. Is there someplace outside of what I've discussed here where I should look?
1. the EOModel reflects a different table as stated above.
2. the code seems to get the data from the right tables.
3. the code inserts the data into only one of the tables, GENEVA_BOOKING.
I am using WO 5.2, XCode 1.5 on OS X 10.3.6
If anyone has any ideas where else I should look, or whatever info I need to consider, I'd appreciate it.
Andrew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden