google app engine - Why error "Joins are only supported when all filters are 'equals' filters." -
i not sure doning wrong here? complains "joins supported when filters 'equals' filters." when query executed. how can around that?
query query = pm.newquery(iteminfo.class); if (lastsyncdate != null) { query.declarevariables("deviceinfo deviceinfo"); query.setfilter("this.todevices.contains(deviceinfo) && " + "deviceinfo.phonenumber == numberparam && createddate > lastsyncdateparam"); query.declareparameters("string numberparam, java.util.date lastsyncdateparam"); map.put("lastsyncdateparam", lastsyncdate); } else { query.declarevariables("deviceinfo deviceinfo"); query.setfilter("this.todevices.contains(deviceinfo) && deviceinfo.phonenumber == numberparam"); query.declareparameters("string numberparam"); } map.put("numberparam", "123456"); query.setordering("createddate desc");
@persistencecapable(identitytype = identitytype.application, detachable = "true") public class iteminfo { @primarykey @persistent(valuestrategy = idgeneratorstrategy.identity) private long id; @persistent private string number; @persistent private list<deviceinfo> todevices; }
app engine's datastore isn't relational, , doesn't support joins, you're doing implicitly using field on referenced model. instead, should fetch entity or entities given phone number, , use keys of entities filter result dataset, eliminating implied join.
Comments
Post a Comment