这个JDOQL是否与以下SQL相同?
Query query = pm.newQuery(Vote.class, ":p.contains(personId)");
if (startDate != null) {
query.setFilter("personId == listOfIds && createdDate > startDateParam");
query.declareParameters("java.util.List listOfIds, java.util.Date startDateParam");
}
else {
query.setFilter("personId == :listOfIds");
}
query.setOrdering("createdDate desc");
List<Vote> list = (List<Vote>) query.execute(listOfIds, startDate);
SELECT * FROM VOTE
WHERE persionID IN (id1, id2..)
AND createdDate > '2011-07-11'
ORDER BY createdDate desc;
答案 0 :(得分:1)
是。请记住,'in'查询会转换为多个基础数据存储查询,因此效率不高 - 如果可以避免,请执行此操作。