I'd like to pass a Collection of ids to get back a list of entities that match those ids. This doesn't seem to work:
public static List<Program> getByIds(Collection<Integer> ids) {
return new Select().from(Program.class)
.where("programId in (?)", ids)
.execute();
}
nor does this when I know I had two ids in the Collection:
public static List<Program> getByIds(Collection<Integer> ids) {
return new Select().from(Program.class)
.where("programId in (?,?)", ids)
.execute();
}
I just get back nothing. And no errors. The program entities do exist as I've done a Select with no where and printed the returned items' ids.
Having to convert the Integer ids into String's and then into a joined String for use in the where clause seems like re-inventing the wheel. Surely, there's a better way?