To summarize the issue, you cannot search for a null (list) if you
store a null value in any instance of that (list) property. This is
due to the way indexing is done for lists/arrays in the datastore.

The short answer is no. You will have to store another property as a
marker that you have a null list/array rather than a list/array that
contains a null entry.

In Objectify (http://code.google.com/p/objectify-appengine) we have a
feature that doesn't store null entries for @Embedded
collection/arrays; instead we store another property which keeps track
of which entries in that collection are null. Then you can search for
any collection that has null entries, but at the moment you can't
search for a null/empty collection (since we don't store them, or any
marker property indicating the difference between null/empty for that
collection). We have plans to add support for differentiating between
null/empty collections in queries, and it will be pretty easy to use,
but we are waiting on more people "needing" that feature.

Here are some discussions relating directly to this issue on the
Objectify group:
http://groups.google.com/group/objectify-appengine/browse_thread/thread/c05efb6943387eb4

On Fri, Feb 19, 2010 at 7:36 AM, vbart <vaclav.barta...@spolecne.cz> wrote:
> Hello,
>
> I'm using low-level datastore API and its Query class to filter
> entities.
> I put two entities to datastore: the first has set a property 'list'
> to null and the second has the same property set to [null] (a list
> containing one null value).
>
> The following query will find both of them - that's ok:
>  new Query("MyEntity").addFilter( "list", Query.FilterOperator.EQUAL,
> null)
>
> But is there a way (using GAE API only) to filter only the first
> entity or only the second one ?
> The full code is on my blog: 
> http://vaclavb.blogspot.com/2010/02/lists-and-nulls-in-google-app-engine.html
>
> Vaclav
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to