Reputation: 35276
I have this Entity in which I need to query for:
@Entity
public class Resource implements Serializable {
@Id
private Long id;
private List<String> key;
}
Here is the query:
List<String> keyPath = key.getFullPath();
Resource result = ofy().load().type(Resource.class).filter("key =", keyPath).first().get();
I'm getting this error:
java.lang.IllegalArgumentException: A collection of values is not allowed.
at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:140)
at com.google.appengine.api.datastore.Query$FilterPredicate.<init>(Query.java:867)
Question:
The idea is to query get the Resource
entity having the same list of strings (key
field) as with the query value.
Upvotes: 0
Views: 546
Reputation: 659
This is the solution for retrieving information from datastore with the single value for the property having list (using Objectify),
Query<Resource> resultset = ofy().load().type(Resource.class).filter("key",keyPath);
Resource firstResult = resultset.first().now();
Upvotes: 0
Reputation: 3115
Have you tried with the IN
operator?
Resource result = ofy().load().type(Resource.class).filter("key IN ", keyPath).first().get();
Upvotes: 1