I'm using the datastore of the Google App Engine (DataNucleus). I have
two classes, one Chat and one Rating. A chat can be rated more then
ones so I created an one-many relationship by adding a list to the Chat
class.

Now I want to know the number of unrated chats, so I did the following:


int numberOfChatsInStock = 0;
for(Chat chat : chats){
if(chat.getRatings().size() == 0){
numberOfChatsInStock++;
}
}

This simply iterate through all chats and checks if the number of
ratings is 0.

This solution works well when there are 10 chats, but when I have 500+
chats then the speed is terrible (15 sec +).

I thought maybe the size() method is faster. So I tried
Query.setFilter("ratings.size() == 0") but this gives me the following
error:
Unsupported method <size> while parsing expression:
InvokeExpression{[PrimaryExpression{ratings}].size(<none>)}

Is there any way to increase the speed?

-- 
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