Hi,
I need help with doing a query that uses a contains filter operation. The
specific use case is that I have to find all users that are have me as a
friend. The User class has a ListLong of friends. In JPA I am able to do
something like this SELECT FROM User u WHERE
select * from User where friends in (200,300,400)
On Tue, Jul 19, 2011 at 3:46 PM, keyvez key...@gmail.com wrote:
Hi,
I need help with doing a query that uses a contains filter operation. The
specific use case is that I have to find all users that are have me as a
friend. The User class has
Use the IN constant
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Query.FilterOperator.html#IN
On Tue, Jul 19, 2011 at 3:49 PM, Bruno Fuster brunofus...@gmail.com wrote:
select * from User where friends in (200,300,400)
On Tue, Jul 19, 2011 at 3:46
Thanks for your quick response. After looking into the IN operator, it
doesn't seem to be what I need. My table looks like this.
User table:
id friends
15
21, 4
31
41, 2
51
I would like to find out who are user 1's friends so the query would be
something like this
It's actually much simpler than you realize. Assuming that your ListLong
is an indexed property named 'friends', you just need to filter entities for
'friends' equal to your id.
This is how list indexes work - if you filter on the property, the entity
matches if any value in the list matches the
just like Jeff said, it will work using a simple equality filter
you can find who's friend with 1 *or* 2 using IN (eg: who is friend with 1,
2 *or* 3)
if you need to find who's friend with 1 *and* 2, query using 2 equality
filters
anyway, be careful with lists... if you have 2 friends following
Thanks Jeff and Bruno, will try that out.
--
You received this message because you are subscribed to the Google Groups
Google App Engine for Java group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine-java/-/0TM8G5toDwYJ.
To post to this group, send