在执行下述hql语句的时候出错,
"select new Channel(c.id, c.name) from Channel c where c.status=1 and c.isIndex=1"
原因是在这个hql语句中,使用了new Channel(c.id,c.name).
这样hibernate就会在我们的实体类中找相应的构造函数。
所以要在Channel.java类中建立对应的构造函数:
public Channel(int id, String name) { super(); this.id = id; this.name = name; }