Hibernate 查询的区别
//从工厂获取的sessionSession session = HibernateSessionFactory.getSession();//org.hibernate.SessionString hql = "from Erpuser as model where model.userName=:userName"+" and model.userPwd=:userPwd";Query query = session.createQuery(hql);query.setParameter("userName", username);query.setParameter("userPwd", pwd);return query.list();//默认使用父类中获取session的方法String hql = "select * from Erpuser as model where model.userName=:userName"+" and model.userPwd=:userPwd";//不加select会报from语法错误SQLQuery query = getSession().createSQLQuery(hql);//org.hibernate.Sessionquery.setParameter("userName", username);query.setParameter("userPwd", pwd);return query.addEntity(Erpuser.class).list();//不加addEntity会报Mapping映射错误可在此处修改映射关系,比如viewbean?