• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mysterious EditingContext Swap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mysterious EditingContext Swap


  • Subject: Re: Mysterious EditingContext Swap
  • From: Fabrice Pipart <email@hidden>
  • Date: Fri, 4 Aug 2006 09:07:02 +0200


On Aug 2, 2006, at 7:05 PM, Chuck Hill wrote:


On Aug 1, 2006, at 8:50 PM, Owen McKerrow wrote:

Nope, not paraphrasing. You can see the full error message at bottom of the email.

The only time I have heard of the active editing context is for a save.

All EOF operations are serialized.  The active editing context is the one that locked the object store (IIRC).  You are not locking your editing contexts properly.  My guess is that this is the root of your problem.  Is this error consistent, or somewhat random?

Chuck

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 :
java.lang.IllegalStateException: Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext

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



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: Mysterious EditingContext Swap
      • From: "Jerry W. Walker" <email@hidden>
References: 
 >Mysterious EditingContext Swap (From: Owen McKerrow <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Ken Anderson <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Owen McKerrow <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: strange EO inheritance issue
  • Next by Date: Re: Oracle initcap: was MSSQL Server 2005 Unicode Support and EOF
  • Previous by thread: Re: Mysterious EditingContext Swap
  • Next by thread: Re: Mysterious EditingContext Swap
  • Index(es):
    • Date
    • Thread