我试了一下,可以呀,
我的输出条件:
where (this.PASSWORD is null and this.FIRST_NAME is null and this.LAST_NAME is null and this.USER_STATUS is null and this.CREATE_DATE is null and this.EXPIRATION_DATE is null and this.IS_ADMIN=? and lower(this.USER_CSS_STYLE) like ? and this.ADDRESS1 is null and this.EMAIL is null and this.FAX_NO is null and this.PHONE_NO is null and this.ZIP_CODE is null and this.ADDRESS2 is null and this.description is null and lower(this.name) like ?)
我的测试代码:
SessionFactory sf =cfg.configure( new File("hibernate.cfg.xml")).buildSessionFactory();
Session session = sf.openSession();
Tuser user = new Tuser();
user.setName("admin");
user.setUserCssStyle("x");
Example example = Example.create(user);
example.ignoreCase().enableLike();
example.excludeZeroes();
example.excludeNone();
Criteria criteria = session.createCriteria(Tuser.class).add(
example);
//criteria.setMaxResults(10);
List list= criteria.list();
System.out.print(list.size());
我的输出条件:
where (this.PASSWORD is null and this.FIRST_NAME is null and this.LAST_NAME is null and this.USER_STATUS is null and this.CREATE_DATE is null and this.EXPIRATION_DATE is null and this.IS_ADMIN=? and lower(this.USER_CSS_STYLE) like ? and this.ADDRESS1 is null and this.EMAIL is null and this.FAX_NO is null and this.PHONE_NO is null and this.ZIP_CODE is null and this.ADDRESS2 is null and this.description is null and lower(this.name) like ?)
我的测试代码:
SessionFactory sf =cfg.configure( new File("hibernate.cfg.xml")).buildSessionFactory();
Session session = sf.openSession();
Tuser user = new Tuser();
user.setName("admin");
user.setUserCssStyle("x");
Example example = Example.create(user);
example.ignoreCase().enableLike();
example.excludeZeroes();
example.excludeNone();
Criteria criteria = session.createCriteria(Tuser.class).add(
example);
//criteria.setMaxResults(10);
List list= criteria.list();
System.out.print(list.size());
解决方案 »
- SpringSecurity3的一个问题,望高手来指点一下!
- json得不到数据!Struts2+jquery~
- ejb生成数据库实体类 ,数据库为MYSQL 不能生成外键(一对多等关系)
- 大家试着写一个简单的web service看看能否返回长字符串?
- datagramsocket和multicastsocket
- timetunnel框架问题。求教
- servlet 和ejb之间能传递类吗? 急待
- 请教:怎样将一个字符串中的XML内容读进JDOM?
- 我的APPLET为什么加载不了XML?
- 用Taglib 和jstl写jsp效率会比直接用java写效率要高吗?
- 使用mysql数据库,为什么在struts struts-config.xml当中配置data-sources中的数据源却不能正确使用呢?
- hibernate:你如何优雅地避开冗余?
我认为只是动态查询的一种技巧............