I'm not sure what will happen when you pass this:

(Key) null

As the query parameter. Instead, what happens if you query on "parentKey ==
null"?

On Tue, Dec 29, 2009 at 11:47 AM, dantuluri <pdantul...@gmail.com> wrote:

> Hi,
>
>    I have the following code:
>
> query = pm.newQuery(File.class);
> query.setFilter("parentKey == parentKeyParam");
> List<File> storedFiles = (List<File>)query.execute((Key)null);
>
>   This query is returning all the Files including those with
> parentKey not null.
>
>   What is wrong with this query? I am kinda stuck. Please help me.
>
> Thanks
>
> On Dec 28, 1:24 pm, "Ikai L (Google)" <ika...@google.com> wrote:
> > You should be able to query for a null value, but you will not be able to
> > query for an empty value. What is the query you are issuing? What is this
> > returning?
> >
> >
> >
> >
> >
> > On Wed, Dec 23, 2009 at 8:29 AM, dantuluri <pdantul...@gmail.com> wrote:
> > > I am new GAE and I need some help. Is it possible to query for
> > > entities with a property value null using GAE JDO query?
> >
> > > I want something like
> >
> > >   "Get me all the Files that don't have a parent"
> >
> > > In regular relational DBs, it can be queried some thing like this:
> > >    "select * from File where parentKey is null"
> >
> > > I have a class something like this:
> >
> > > public class File {
> > >      @Persistent
> > >      @PrimaryKey
> > >      private Key id;
> >
> > >      @Persistent
> > >      String name;
> >
> > >       @Persistent
> > >       private Key parentKey;
> > > }
> >
> > > When I am querying for Files that have null parentKey, query returns
> > > all Files including those with non-null parentKey value. Is this
> > > possible to do with GAE?
> >
> > > Thanks!
> >
> > > On Dec 22, 1:33 pm, dantuluri <pdantul...@gmail.com> wrote:
> > > > Hi,
> >
> > > >     I have an entity that has the following structure:
> >
> > > > File  which has Key as primary key and ParentKey that refers to
> > > > another File which is parent of this File. Example data for this
> > > > structure looks like this:
> >
> > > > Key: File(2)
> > > > Name: Inbox
> > > > parentKey: File(1)
> >
> > > > It is possible that File may not have a parentKey.
> >
> > > > I want to query the DataStore for Files that don't have parent file
> > > > (parentKey == null). But when I am querying with parentKey == null, I
> > > > am still getting all Files including those with parentsKeys. How can
> > > > we do this with JDO query with App Store? I must be missing something
> > > > basic here.
> >
> > > > Similarly I would like to get the child folders of a given folder
> > > > (parentKey == File(1)).
> >
> > > > Any help would be appreciated!
> >
> > > > Thanks
> >
> > > --
> >
> > > 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<google-appengine-java%2bunsubscr...@googlegroups.com><google-appengine-java%2B
> unsubscr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine-java?hl=en.
> >
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App Engine
>
> --
>
> 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<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine

--

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