Hibernate query interface setparameter method: bind parameters of any type
•
Java
setParameter(String name,Object val)
Example
String hql = "from UserForm where username=:userName"; //定义查询HQL语句 Query query = session.createQuery(hql); //执行查询语句获取Query对象 query.setParameter("userName","wgh"); //设置HQL语句参数 list = query.list();
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
二维码