打印我的 HQL:
@Query("SELECT count(a.age) as age, count(w.weight) as weight from animals a inner join weight_table w on a.id = w.id")
我想将其返回为: List<MyObject>而不是List<Object[]>
我有这门课:
public class MyObject {
private int age;
private int weight;
// getters setters all args constructor
}
是否可以使用如下方式在我的 HQL 中进行转换:
SELECT new.com.cs.MyObject(age, weight) count(a.age) as age, count(w.weight) as weight from animals a inner join weight_table w on a.id = w.id
红颜莎娜
守着一只汪
相关分类