hmmm, having rechecked, are you sure that you can do an AND if your query 
is a "selectFromKeysOnly". Isn't there a more generic query?

Cheers

On Monday, July 13, 2015 at 11:11:11 AM UTC-4, Patrice (Cloud Platform 
Support) wrote:
>
> Hi,
>
> As far as I know, datastore can take AND queries with no trouble. I'm 
> thinking this might be the library you're using to interact with the 
> datastore that might do this.
>
> I assume if you try a simple "where" clause just checking for your date 
> component, it works?
>
> Cheers
>
> On Sunday, July 12, 2015 at 1:50:27 PM UTC-4, Marcus Masekowsky wrote:
>>
>> Hi,
>>
>> I am trying to add a AND-Expression to a GAE batch query to filter 
>> Entities:
>>
>> Currently I am doing this, and it works perfect:
>> 1. 
>> DBQuery.selectFromKeysOnly -> Query to select Entitie by key
>>
>> 2. 
>> String queryBatchString = "select from " + C1.class.getName() 
>>  + " where " 
>>                                  + Model.KEY_FIELD + " == :keys";
>> 3. 
>> Query query = pm.newQuery(queryBatchString);
>> modelList = (List<Model>)query.execute(encodedKeyList);
>>
>> The disadvantage with that approach is, that the query in step 2 always 
>> returns all Entities. But I only want Entites which have a date > current 
>> Date. Currently I am filtering the Entities in the server code (Step 4). 
>> To avoid this, I changed the query in 2. and added an "AND" expression to 
>> filter the entities directly:
>>
>> String queryBatchString = "select from " + C1.class.getName() 
>>  + " where " 
>>                                  + Model.KEY_FIELD + " == :keys"
>>  +  " AND " + C1.C1_DATE_FIELD + " > "+ currDate.getTimeInMillis();
>>
>>
>> But with this change I get an QueryCompilerSyntaxException:
>> "
>> Portion of expression could not be parsed: AND encodedKey == :keys
>> org.datanucleus.store.query.QueryCompilerSyntaxException: Portion of 
>> expression could not be parsed: AND encodedKey == :keys
>> "
>>
>> What is wrong or what can be done better. Are AND-Expressions not allowed 
>> in Bbatch Queries?
>>
>>
>> Thanks 
>> Marcus
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/144304d2-755a-4841-8f7d-63547e445bc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to