Hibernate query interface setparameter method: bind parameters of any type

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
分享
二维码
< <上一篇
下一篇>>