I am using 3.0 Apache Cayenne, how can I ommit @SuppressWarnings("unchecked") in Eclipse for such simple code:
public List<Some> getSomes() {
SelectQuery select = new SelectQuery(Some.class);
List<Some> somes = dbContext.performQuery(select);
return somes;
}
I cannot find any solution, is it because (I think) performQuery retuns an object List ?
Generics in queries is a feature available since Cayenne 3.2. In 3.2 you'd run queries like this, getting type-safe results:
SelectQuery<Some> select = new SelectQuery<>(Some.class);
List<Some> somes = dbContext.select(select);
But there will be 'unchecked' warnings if you are using 3.0. There's no way around this.