使用“Criteria”将下面给出的代码转换为java的等效代码是什么? [英] What is the equivalent code of this given below code into java using 'Criteria' ?
本文介绍了使用“Criteria”将下面给出的代码转换为java的等效代码是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从table_name中选择*其中country_code ='IN';
数据库包含许多具有不同国家/地区代码的数据。例如:IN(印度),GB(英国),美国(美国) )等等
Select * from table_name where country_code='IN';
Database has so many datas with different country code.For example:IN(India),GB(Great Britain),US(United State) etc.
推荐答案
试试这个...
标准cr = session.createCriteria(国家。 class);
cr.add(Restrictions.eq(code,IN));
列出结果= cr.list();
Try this...
Criteria cr = session.createCriteria(Country.class);
cr.add(Restrictions.eq("code", 'IN'));
List results = cr.list();
这篇关于使用“Criteria”将下面给出的代码转换为java的等效代码是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文