1

My Owner class has 6 string attributes. I want to write a JDO query which should check a string with those all 6 attributes of Owner class and if any of those 6 attribute matches then that owner object should be added in list. I am using following JDO query syntax but its not working:

 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); 

i am getting following exceptoin:

 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).

Any idea how can i write a query for that. Thanks in advance.

Piscean
  • 3,069
  • 12
  • 47
  • 96
  • i think the problem is, that there are OR statements. can’t find any mistake in your code... trie to use branch1 == ‚technic‘ || branch2 == ‚technic‘... that means build the string and do not use params.... (i am using params and its working but i have no Or-statements) – headgrowe Sep 04 '12 at 18:32
  • You mean like the message says "Or filters cannot be applied to multiple properties" ? a current limitation of the underlying GAE datastore. – DataNucleus Sep 04 '12 at 18:36

0 Answers0