@SuppressWarnings("unchecked")
public List<Customer> findByIdCard(String idcard,final int firstResult) {
final String hql=" from Customer c where c.idCard='"+idcard+"' order by c.id";
System.out.println(hql);
List<Customer> list = hibernateTemplate.executeFind(new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query query = session.createQuery(hql);
query.setFirstResult(firstResult);
query.setMaxResults(10);
List list = query.list();
session.clear();
return list;
}
});
return list;
}
转载于:https://blog.51cto.com/8648389/1598875