为什么JDOQL中的无标记注释“OR”不起作用?

时间:2013-05-05 12:33:25

标签: google-app-engine jdo datanucleus jdoql

Here描述了如何通过无主的一对一关系过滤实体:

Food chocolate = /*...*/;

Query q = pm.newQuery(Person.class);
q.setFilter("favoriteFood == favoriteFoodParam");
q.declareParameters(Key.class.getName() + " favoriteFoodParam");

List<Person> chocolateLovers = (List<Person>) q.execute(chocolate.getKey());

这完美地运作,但如果我有一个以上的最喜欢的食物派对怎么办?

我尝试将过滤器修改为:

q.setFilter("favoriteFood == favoriteFoodParam1 || favoriteFood == favoriteFoodParam2");
q.declareParameters(Key.class.getName() + " favoriteFoodParam1,"+Key.class.getName() + " favoriteFoodParam2");

但是执行return 0对象,如果我删除了favoriteFoodParam1或者favoriteFoodParam2则返回不是0.

0 个答案:

没有答案