Despite the fact that my JDO query contains TWO declareParameters
statements, the code below produces an error claiming only one parameter is accepted:
Query requires 1 parameters, yet 2 values have been provided.
The two parameters are amountP
and taxP
:
javax.jdo.Query query= pm.newQuery(Main.class);
query.setFilter("amount == amountP && tax < taxP");
query.declareParameters("int amountP");
query.declareParameters("int taxP");
List<Main> results = (List<Main>)query.execute (amountP, taxP);
However, with the following changes, it works.
javax.jdo.Query query= pm.newQuery(Main.class);
query.setFilter("amount == amountP && tax < taxP");
query.declareParameters("int amountP, int taxP");
List<Main> results = (List<Main>)query.execute (amountP, taxP);
My question is: What was wrong with the original syntax?
Update: This problem has been reported by others but without explanation.