IIRC, EOQualifier is the problem here. The semantics of in memory evaluation on 
a keyPath that has a toMany key is different to the SQL result when using the 
same qualifier in a FetchSpec.

In memory is going to call valueForKeyPath( "pages.empty" ) on each Book 
object. The result of that valueForKeyPath is probably an NSArray of Booleans 
and NSArray will never be equal to Boolean.TRUE. Debug step the code and see if 
that is the case.

See the thread from Feb 6/7 with subject 
"EOKeyValueQualifier.evaluateWithObject on EOQualifier.QualifierContains 
selector?"



On Mar 28, 2012, at 2:00 PM, Henrique Prange wrote:

> Hi there,
> 
> I'm trying to fix a problem in WOUnit, but it seems to be a bug in the core 
> qualifier evaluation for objects in memory. Here is a sample code that 
> demonstrates the problem:
> 
> Page page = Page.createPage(editingContext);
> 
> page.setEmpty(true);
> 
> Book book = Book.createBook(editingContext);
> 
> book.addToPagesRelationship(page);
> 
> // Get all books with empty pages
> EOQualifier qualifier = Book.PAGES.append(Page.EMPTY).isTrue();
> 
> NSArray<Book> result = ERXQ.filtered(new NSArray<Book>(book), qualifier);
> 
> The result array should contain the Book I've just created, but the array 
> returned is empty. :(
> 
> Is there an alternative way to evaluate the qualifier in memory? Should I 
> create the qualifier in a different manner? Any clues on how could I fix this 
> problem without writing my own qualifier evaluator?
> 
> Cheers,
> 
> Henrique
> _______________________________________________
> 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/kelleherk%40gmail.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