public void query(String name) {
Session s = null;
try {
s = HibernateUtil.getSession();
String hql = "from User as user where user.name=?";
Query query = s.createQuery(hql);
query.setString(0, name);
List list =new ArrayList();
for(User user:list) {
System.out.println("user.name="user.getName());
}
}catch(Exception e){
e.printStackTrace();
}
}
阅读(695) | 评论(0) | 转发(0) |