Createcriteria method of Hibernate criteria interface: create a new criteria object

createCriteria(String associationPath)

Example

Session session = sessionFactory.openSession();  //获取session对象
Criteria criteria = session.createCriteria(TbTopic.class);  //示例化Criteria对象
criteria.createCriteria("tbType").add(Restrictions.eq("typeName","Java技术专区"));  //调用createCriteria方法
List list = criteria.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
分享
二维码
< <上一篇
下一篇>>