首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Property path [.] does not reference a collection

2012-11-05 
Property path [...] does not reference a collectioncriteria.add(Restrictions.or(Restrictions.ne(is

Property path [...] does not reference a collection
criteria.add(Restrictions.or(Restrictions.ne("isCancelled", null), Restrictions.isNull("isCancelled")));
在使用hiberante查询时,“isCancelled” 字段的值可能为空值,使用isEmpty(propertyName)、isNull(propertyName)都会报Property path [...] does not reference a collection异常,将为空的查询改为 Property.forName("isCancelled").isNull()即:
criteria.add(Restrictions.or(Restrictions.ne("isCancelled", null), Property.forName("isCancelled").isNull()));
ok,搞定了。

热点排行