Hibernate query interface setdouble method: bind parameters with mapping type of double

Grammar 1

setDouble(int position,double val)

Example

String hql = "from GoodsForm where price=?";  //定义查询HQL语句
Query query = session.createQuery(hql);  //定义HQL语句获取Query对象
query.setDouble(0,5967.2);  //设置HQL语句参数

Grammar 2

setDouble(String name,double val)

Example

String hql = "from GoodsForm where price=:price";  //设置查询HQL语句
Query query = session.createQuery(hql);  //执行HQL获取Query对象
query.setDouble("price",5967.2);  //绑定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
分享
二维码
< <上一篇
下一篇>>