如何编写JDO查询以使用一个字符串参数检查多个对象属性?

时间:2012-09-03 10:42:13

标签: jdo jdoql

我的所有者类有6个字符串属性。我想编写一个JDO查询,该查询应检查具有Owner类的所有6个属性的字符串,如果这6个属性中的任何一个匹配,那么应该在列表中添加该所有者对象。我正在使用以下JDO查询语法,但它不起作用:

 String branchName = req.getParameter("branch");
 List<Owner> owners = null;
 Query query = pm.newQuery(Owner.class);
 query.setFilter("branch1 == branchParam || branch2 == branchParam || branch3 == branchParam || branch4 == branchParam || branch5 == branchParam || branch6 == branchParam");
 query.declareParameters("String branchParam");
 companies = (List<Owner>) query.execute(branchName); 

我正在追踪例外情况:

 org.datanucleus.store.appengine.query.DatastoreQuery$UnsupportedDatastoreFeatureException: Problem with query <SELECT FROM com.eplinovo.stallbokenapp.domain.HastForetag WHERE branch1 == branchParam || branch2 == branchParam || branch3 == branchParam || branch4 == branchParam || branch5 == branchParam || branch6 == branchParam PARAMETERS String branchParam>: Or filters cannot be applied to multiple properties (found both branch1 and branch2).

我知道如何为此编写查询。提前谢谢。

0 个答案:

没有答案