• 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: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder


  • Subject: Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
  • From: David Holt <email@hidden>
  • Date: Fri, 7 Apr 2006 16:10:53 -0700


On 7 Apr 2006, at 11:48 AM, Chuck Hill wrote:


    /** @TypeInfo Meeting */
    public NSArray meetingsRepetition()
    {
        return meetingsRepetition;
    }
    public void setMeetingsRepetition(NSArray newMeetingsRepetition)
    {
        EOFetchSpecification fetchSpec = new EOFetchSpecification();
ApplicationUser user = ((Session)session()).user();

EOFetchSpecification fetchSpec = new EOFetchSpecification("ApplicationUser",
qualifierForEnterpriseObject(user.editingContext(), user),
NSArray.EmptyArray);


fetchSpec.setRefreshesRefetchedObjects(true);
fetchSpec.setPrefetchingRelationshipKeyPaths(new NSArray("meetings"));
meetingsRepetition = editingContext().objectsWithFetchSpecification(fetchSpec);
// meetingsRepetition = newMeetingsRepetition;
    }


Thanks Chuck,

I have updated the code using your suggestion as a starting base. I have separated all the steps of the fetch specification as I was learning what each thing meant. The code above is returning ApplicationUsers and I am pretty sure I need to replace that with "Meeting". I think this makes the prefetching unnecessary. Here is the changed code:

    public NSArray meetingRepetition()
    {
        EOQualifier myQualifier;
NSArray mySortOrderings;
ApplicationUser applicationUser = (ApplicationUser) valueForKeyPath("session.user");
EOEditingContext ec = applicationUser.editingContext();
EOFetchSpecification fetchSpec = new EOFetchSpecification();
fetchSpec.setEntityName("Meeting");
myQualifier = EOUtilities.qualifierForEnterpriseObject(ec, applicationUser);
fetchSpec.setQualifier(myQualifier);
mySortOrderings = NSArray.EmptyArray;
fetchSpec.setSortOrderings(mySortOrderings);
fetchSpec.setRefreshesRefetchedObjects(true);
// fetchSpec.setPrefetchingRelationshipKeyPaths(new NSArray("meetings"));
Session sess = (Session)session();
EOEditingContext myEC = sess.defaultEditingContext();
meetingRepetition = myEC.objectsWithFetchSpecification(fetchSpec);
return meetingRepetition;
    }

This gives an application error (see below) on the many to many relationship. How do I set the qualifier for the user that is logged in?

Application:
WOMeeting
Error:
java.lang.IllegalStateException: sqlStringForKeyValueQualifier: attempt to generate SQL for com.webobjects.eocontrol.EOKeyValueQualifier (applicationUserID = 1) failed because attribute identified by key 'applicationUserID' was not reachable from from entity 'Meeting'
Reason:
sqlStringForKeyValueQualifier: attempt to generate SQL for com.webobjects.eocontrol.EOKeyValueQualifier (applicationUserID = 1) failed because attribute identified by key 'applicationUserID' was not reachable from from entity 'Meeting'
 _______________________________________________
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: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
      • From: Chuck Hill <email@hidden>
References: 
 >Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder (From: David Holt <email@hidden>)
 >Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Secret EOModeler information
  • Next by Date: Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
  • Previous by thread: Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
  • Next by thread: Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
  • Index(es):
    • Date
    • Thread