Hibernate query interface setboolean method: bind parameters with mapping type of Boolean
•
Java
Grammar 1
setBoolean(int position,boolean val)
Example
String hql = "from UserForm where isDel=?"; //定义HQL语句 Query query = session.createQuery(hql); //执行HQL语句获取Query对象 query.setBoolean(0,true); //绑定HQL语句参数
Grammar 2
setBoolean(String name,boolean val)
Example
String hql = "from UserForm where isDel=:isDel"; //定义查询HQL语句 Query query = session.createQuery(hql); //执行HQL语句获取Query对象 query.setBoolean("isDel",true); //设置HQL语句参数
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
二维码