Play Framework / JPA 中是否有一个快捷方式来保存手动构建此查询?
public List<User> getAllExceptThese(Collection<String> emails) {
checkArgument(!emails.isEmpty());
StringBuilder query = new StringBuilder("email not in (");
boolean first = true;
for (String email : emails) {
if (!first) {
query.append(", ");
}
first = false;
query.append("?");
}
query.append(")");
return findAll(query.toString(), emails.toArray());
}