Hibernate query interface list method: returns the list collection of query results
•
Java
list()
Example
Session session = sessionFactory.openSession(); //获取session对象
String hql = "from UserForm"; //定义查询HQL语句
List list = null;
try{
Query query = session.createQuery(hql); //执行查询语句,获取Query示例
list = query.list(); //调用list()方法返回一个List集合
}catch(Exception e){
System.out.println("查询用户信息时的错误信息:"+e.getMessage());
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
