Are you actually experiencing performance issues? If not, I would just use 
count == 0.

WebObjects is incredibly efficient and I would trust it to do the right thing 
until it doesn’t. It is easy to waste a lot of time trying to fix things that 
are not actually a problem.

You can always put it in a little method:

public boolean someRelationshipIsEmpty() {
        return someRelationship().count() == 0;
}

Then if it is an issue later, you can take care if it in one place.

Steve 


> On Feb 3, 2016, at 10:10 PM, Theodore Petrosky <[email protected]> wrote:
> 
> but what about raw SQL? Instead of talking to the EO.
> 
> Of course my methods always end up convoluted but I thought about putting a 
> method on the EO that uses raw SQL to return the count of related objects.
> 
> 
>> On Feb 3, 2016, at 8:34 PM, OC <[email protected]> wrote:
>> 
>> Hello there,
>> 
>> I'd bet this must be a WebObjects 101, but I can't see the best answer: is 
>> there an efficient way of checking whether an eo.someRelationship is empty?
>> 
>> So far I simply check eo.someRelationship.count==0, but that might fire a 
>> fault, which is not exactly efficient if the only need is to know whether 
>> the relationship is empty or not.
>> 
>> Of course I could rig myself something like “if already fetched in, simply 
>> check array count; if still fault, fetch max one object and see whether 
>> there's any...”, but this looks like a ubiquitous task enough it simply 
>> _must_ be done already (and in a far better way than I would do it myself)?
>> 
>> Thanks for any advice,
>> OC
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yahoo.com
>> 
>> This email sent to [email protected]
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/speery%40me.com
> 
> This email sent to [email protected]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to