2014-05-15 23 views
0

我使用3.0阿帕奇卡宴, 我怎麼能ommit @SuppressWarnings(「未登記」)在Eclipse這樣的簡單代碼:阿帕奇卡宴performQuery結果列表中投

public List<Some> getSomes() { 
    SelectQuery select = new SelectQuery(Some.class); 
    List<Some> somes = dbContext.performQuery(select); 
    return somes; 
} 

我找不到任何解決方案,是因爲(我認爲)performQuery回調一個對象列表?

回答

0

查詢中的泛型是Cayenne 3.2以來的一項功能。在3.2你會像這樣運行查詢,得到類型安全的結果:

SelectQuery<Some> select = new SelectQuery<>(Some.class); 
List<Some> somes = dbContext.select(select); 

但如果您使用的是3.0會有「選中」警告。這是沒有辦法的。