On Aug 2, 2006, at 7:05 PM, Chuck Hill wrote:
I am experiencing exactly the same problem. Here is my context : WebObjects 5.2.4 Mac OS 10.4.7 MySQL 4.1.18 We are using a child editing context between some pages. BTW : is it necessary to lock a child ec after creating it? (I tried it did not change anything) The problem appeared when we decided to use addObjectToBothSidesOfRelationship whenever we set an eo relationship. Here is my code : public WOComponent book() { // create the campaign object MediaBookingCampaign campaign = (MediaBookingCampaign) EOUtilities.createAndInsertInstance(childEC, "MediaBookingCampaign"); campaign.setAccountRelationship(media.account()); // this does an addObjectToBothSidesOfRelationship which works campaign.setCost(new Double(totalCost)); campaign.setName(campaignName); campaign.setMediaRelationship(media); // this does an addObjectToBothSidesOfRelationship which works // create the mediaBookings objects processBooking(campaign, null, null); // save the syncBookings childEC.saveChanges(); session().defaultEditingContext().saveChanges(); return pageWithName("com.easyshadow.webui.booking.MediaBookingsComponent"); } /** * create all the necessary mediaBookings objects for the MediaBookingCampaign */ private void processBooking(MediaBookingCampaign mediaBookingCampaign) { Playlist playlist; MediaBooking mediaBooking; for (int i = 0; i < selectedPlaylists.count(); i++) { playlist = (Playlist) selectedPlaylists.objectAtIndex(i); // if there is some playtimes, create the mediaBookings if (!playtimes.equals("0")) { mediaBooking = (MediaBooking) EOUtilities.createAndInsertInstance(childEC, "MediaBooking"); mediaBooking.setMediaRelationship(media); mediaBooking.setMediaBookingCampaignRelationship(mediaBookingCampaign); mediaBooking.setPlaylistRelationship(playlist); mediaBooking.setBookingDate(new Long(new GregorianCalendar(TimeZone.getTimeZone("GMT")).getTimeInMillis())); } } } Before saving the default editing context (in book() ), I checked that in it : - all inserted objects (both the MediaBooking and the MediaBookingCampaign are here) are in the default editing context - all changed objects (both the MediaBooking and the MediaBookingCampaign are here) are in the default editing context But I end up with a :
in com.webobjects.eoaccess.EODatabaseContext._globalIDForObject It seems I have a MediaBooking in the childEc ! Where does that one come from ??? Thanks to anyone who could help ! Fabrice www.easyshadow.com International Corporate Consulting Palais de la Scala 1 avenue Henri Dunant Suite 1155 MC - 98000 Monaco Skype: fabrice.pipart Tel. +377 97 98 21 04 (direct) Fax. +377 97 70 88 07 |
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to archive@mail-archive.com