Hibernate query interface setentity method: used to bind entity class parameters
•
Java
setEntity(String name,Object val)
Example
Dept d = new Dept(); //定义表示部门实体的JavaBean对象
d.setId(3); //设置JavaBean对象编号属性
Query q = session.createQuery("from Staff where dept_id=:DEPT"); //执行查询语句获取Query对象
q.setEntity("DEPT",d);//绑定查询参数
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
二维码
