hibernate三种分页对性能有影响吗? 一法:
String sql = "select * from GoodsMessage g where g.gType="+"'"+gtype+"'"+" limit "+((curPage-1)*pageSize)+","+pageSize+"";
list = (List<GoodsMessage>)sessionFactory.openSession().createSQLQuery(sql).addEntity(GoodsMessage.class).list();
二法:
String sql = "from GoodsMessage g where g.gType="+"'"+gtype+"'";
list = (List<GoodsMessage>)sessionFactory.openSession().createQuery(sql).setFirstResult((curPage-1)*pageSize).setMaxResults(pageSize).list();
三法:
final String sql = "from GoodsMessage g where g.gType="+"'"+gtype+"'";
return (List<GoodsMessage>)this.getHibernateTemplate().execute(new HibernateCallback() {