query = this.getSession().createSQLQuery(sql);
query.addEntity(Member.class); //addEntity(po.class)将查出的list对象封装到po对象里
// query.setResultTransformer(Transformers.aliasToBean(Member.class)); 用于转变vo
List<Member> list = query.setFirstResult((page - 1) * pageSize)
.setMaxResults(pageSize).list();
用自已写的sql后,加上addEntity(.class)转变成list对象集合
最新推荐文章于 2019-05-07 12:49:16 发布