欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Hql查询

程序员文章站 2022-04-15 22:53:34
...
public List<Student> findStudent(String stuNo,String stuName){
	String hql = "from Student t where t.stuNo =: stuNo and t.stuName =: stuName ";
	Query query = sessionFactory.getCurrentSession().createQuery(hql);
	query.setParameter("stuNo",stuNo);
	query.setParameter("stuName",stuName);
	List<Student> list = query.list();
	return list;
}