首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Spring + Hibernate 学习笔记-hql条件查询中的空值有关问题

2012-10-30 
Spring + Hibernate 学习笔记-hql条件查询中的空值问题今天用Hql进行条件查询,有个条件是某个属性的值为nu

Spring + Hibernate 学习笔记-hql条件查询中的空值问题

今天用Hql进行条件查询,有个条件是某个属性的值为null,用setParameter指定为null运行不通过,返回的结果为0,

session.createFilter(u.getAbtRelationsesForUser1id(),"where this.status = ?").setParameter(0, null).list;

?后来通过打印出来的sql语言发现匹配null值还是用的“=”,于是采用最原始的方法:

session.createFilter(u.getAbtRelationsesForUser1id(),"where this.status is null").list;

?问题解决了。

热点排行