HQL クエリからオブジェクトを作成しようとしていますが、何が間違っているのかわかりません。
クエリ:
String query = "SELECT product.code, SUM(product.price), COUNT(product.code)
from Product AS product
GROUP BY product.code"
(または、マップされていなくても、 new MyCustomList(product.code, SUM(... を使用する必要がありますか?) この返されたリストを同様のオブジェクトにキャストしたいと思います。
class MyCustomList{
public String code;
public BigDecimal price;
public int total;
// Constructor
public MyCustomList(String code, String price, int total){ //...
データの取得:
// This throws ClassCastException
List<MyCustomList> list = MyClass.find(query).fetch();
Play フレームワークの使用