ParentEntity.getKey().getChild(ChildKind, keyname);
Dec 12, 2012
GAE- Generate Child Entity key
Here the simple way to make.
GAE- The method addFilter(String, Query.FilterOperator, Object) from the type Query is deprecated
In this situation, we can fixed this by changing out code.
Import the Libraries
import com.google.appengine.api.datastore.Query; import com.google.appengine.api.datastore.Query.CompositeFilterOperator; import com.google.appengine.api.datastore.Query.FilterOperator;
Sample:
Query query = new Query(Kind); query.addFilter("active", FilterOperator.EQUAL, 1l); query.addFilter("user", FilterOperator.EQUAL, _user);
Solution1:
Filter activeFilter = new FilterPredicate("active",FilterOperator.EQUAL,1l); Filter userFilter = new FilterPredicate("user",FilterOperator.EQUAL,_user); // Combine the Two filter Filter queryFilter = CompositeFilterOperator.and(activeFilter, userFilter); // Use class Query to assemble a query Query q = new Query("Person").setFilter(queryFilter);
Solution 2
query = new Query(Kind); query.setFilter(CompositeFilterOperator.and( FilterOperator.EQUAL.of("active", 1l), FilterOperator.EQUAL.of("user", _user) ) );
If you want look more info you cant find Datastore Queries and GAE Query
Happy Reading
Subscribe to:
Posts (Atom)