• 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: Couting the objects that would be returned by a fetch specification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Couting the objects that would be returned by a fetch specification


  • Subject: Re: Couting the objects that would be returned by a fetch specification
  • From: Kieran Kelleher <email@hidden>
  • Date: Thu, 11 Dec 2008 12:57:32 -0500

For relationships you can put something like the method shown below in your custom EO subclass. One set of the eogen templates out there have this too IIRC. I added the check for ec changes since the count might be inaccurate otherwise and will definitely fail for new unsaved objects.....

/**
* This method is protected since they are to be called by eogenerated templates.
* If object not saved, uses standard array count, otherwise uses database count
*
* @param key
* @return count for the given relationship.
*/
protected Integer countForRelationship(String key)
{
if (editingContext().hasChanges()) {
return (Integer) valueForKeyPath(key + ".@count");
} else {
EOQualifier qual = qualifierForRelationshipWithKey(key);


String anEntityName = this.entityName();
EOEntity anEntity = EOModelGroup.defaultGroup().entityNamed(anEntityName);
EORelationship aRelationship = anEntity.relationshipNamed(key);
return ERXEOControlUtilities.objectCountWithQualifier(this.editingContext(), aRelationship
.destinationEntity().name(), qual);
}
}


HTH, Kieran

On Dec 11, 2008, at 5:17 AM, David Avendasora wrote:

Hi Jerry,

It appears that wocode is no longer there.

Can you possibly post the CountFetcher.java code here or some other easy to access place?

Thanks!

Dave

On Jan 21, 2006, at 3:40 PM, Jerry W. Walker wrote:

Hi, Miguel,

You might try CountFetcher.java which can be downloaded from:

  http://wocode.com/cgi-bin/WebObjects/WOCode.woa/2/wa/ShareCodeItem?itemId=429

Regards,
Jerry

On Jan 21, 2006, at 2:10 PM, Miguel Arroz wrote:

Hi!

This is probably very obvious, but... how can I count the objects that would be retuned by a fetch specification, but without actually fetching them (or creating faults for them)? What I would like to do is something like the COUNT SQL function.

Yours

Miguel Arroz

"We have no sympathy for the lost souls
We've chosen the path of disgrace
We give this life to our children
And teach them to hate this place" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com


_______________________________________________ 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


--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems


 email@hidden
 203 278-4085        office



_______________________________________________
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



_______________________________________________ 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

_______________________________________________ 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
References: 
 >Re: Couting the objects that would be returned by a fetch specification (From: David Avendasora <email@hidden>)

  • Prev by Date: Re: New WOLips is Coming
  • Next by Date: Re: Couting the objects that would be returned by a fetchspecification
  • Previous by thread: Re: Couting the objects that would be returned by a fetchspecification
  • Next by thread: New WOLips is Coming
  • Index(es):
    • Date
    • Thread