I noticed that i can make a query like this:
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
Query query = new Query("DbContact");
query.addFilter("__key__", FilterOperator.GREATER_THAN,
KeyFactory.stringToKey(a_key_string));
And it works. It fetches the correct results.
Then i also noticed i can do this (locally on my computer; i haven't tested
this on app-engine yet):
entity.put("__key__", "some value");
ds.put(entity);
Using the datastore viewer i can see the object with this property (__key__)
and the corresponding value i've set.
Then if try a query like this:
q1.addFilter("__key__", FilterOperator.EQUAL, "some value");
it doesnt' fetch any results!
So can someone explain the mechanism of what is happening over here? :)
One last thing i've noticed:
If i try the following line in DataViewer --> Query (using GQL):
SELECT * FROM DbCategory where __key__ > 'a'
I get:
server error(500)
Server Error
A server error has occurred.
And also, are there any other "reserved" properties like "__key__" i should
be aware of, or which are useful for special kinds of queries.?
On Fri, Sep 4, 2009 at 2:17 PM, Cornel <[email protected]> wrote:
>
> Hello,
>
> How can i make a Query using the lowlevel API, similar to this:
> select * from Entity where key > <certain_key> ?
>
> In JDO i would do something like this:
> select * from Entity where encodedKey > <a_key_string>
>
> where encodedKey is my objects' primary key:
>
> @PrimaryKey
> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> @Extension(vendorName="datanucleus", key="gae.encoded-pk",
> value="true")
> private String encodedKey;
--
Corneliu Paul Lupulet
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---