hibernate处理null 时提示:Property path [...] does notreference a collection
Hibernate判断某属性不为null 且不可为空时出现Property path [...] does notreference a collection 的问题
处理空的方法:
isNotEmpty(propertyName)、isNotNull(propertyName)
但是此时报都会报Property path [...] does notreference a collection异常
此时需要将不为空或空查询改为Property.forName("isCancelled").isNotNull()
即:
criteria.add(Restrictions.or(Property.forName("isCancelled").isNotNull(),Restrictions.ne("isCancelled",null))); ions.ne("lqprovince", ""));
或者
criteria.add(Restrictions.or(Restrictions.ne("isCancelled",null), Property.forName("isCancelled").isNotNull()));
hibernate处理null 时提示:Property path [...] does notreference a collection的更多相关文章
- 解决vmware fusion + centos 7安装vmtools时提示The path "" is not a valid path to the xxx kernel headers.
近日使用VMware fushion 8 + centos 7.0时,无法使用共享功能,所以必须安装vmtools.但是安装过程中有2个错误需要解决. 1.gcc错误 Searching for GC ...
- vmware + centos 7安装vmtools时提示The path "" is not a valid path to the xxx kernel header
在安装vmtools时无意中出现了这样的问题 1.gcc错误 Searching for GCC- The path "" is not valid path to the gcc ...
- centos 7安装vmtools时提示The path "" is not a valid path to the xxx kernel headers.
解决办法: yum -y install kernel-headers kernel-devel gcc reboot
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.chen.vo.Dept.parentId
异常描述:执行以下的addAsHaveParentId2方法出现此异常: /*-----------------------类Dept.Dept.hbm.xml有parentId属性(数据库中有此列) ...
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.trs.om.bean.User.retryCount
六月 29, 2019 5:42:45 下午 org.apache.catalina.core.AprLifecycleListener init信息: The APR based Apache To ...
- 关于Hibernate级联更新插入信息时提示主键不为空的问题“org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1 ”
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual ...
- npm ERR! Cannot read property 'path' of null
npm错误: 错误信息如下: $ sudo npm install -g bean-sdk sudo: npm: command not found $ npm install -g bean-sdk ...
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.xugao.bean.MemberLevel.memberpointrate
由于数据不合法的原因,好几次遇到: org.hibernate.PropertyAccessException: Null value was assigned to a property of pr ...
- Mybatis:使用bean传值,当传入值为Null时,提示“无效的列类型”的解决办法
问题描述:在使用mybatis对数据库执行更新操作时,parameterType为某个具体的bean,而bean中传入的参数为null时,抛出异常如下:org.mybatis.spring.MyBat ...
随机推荐
- C#开发微信门户及应用(14)-在微信菜单中采用重定向获取用户数据
我曾经在系列文章中的<C#开发微信门户及应用(11)--微信菜单的多种表现方式介绍>中介绍了微信菜单里面的重定向操作,通过这个重定向操作,我们可以获取一个code值,然后获取用户的open ...
- A2W、W2A、A2T、T2A的使用方法
1.A2W和W2A 在<Window核心编程>,多字节和宽字节之间转换比较麻烦的,MultiByteToWideChar函数和WideCharToMultiByte函数有足够多的参数的意义 ...
- shiro在springmvc里面的集成使用【转】
<dependency> <groupId>commons-collections</groupId> <artifactId>commons-coll ...
- js 轮播效果
<!--图片轮播 Start--> <div class="pics-ul"> ...
- 移除HTML5 input在type="number"时的上下小箭头
/*移除HTML5 input在type="number"时的上下小箭头*/ input::-webkit-outer-spin-button, input::-webkit-in ...
- JS实现文字截取(雾)
今天在跳板群那里看到一个神奇的样式,效果: 感觉十分神奇,因为一开始以为他是只有一个P元素包着文字然后最后一个自动截取文字,而且最后一行还可以提前截取???这怎么做到的,然后想了一下css怎么做,好像 ...
- node 异步回调解决方法之yield
先看如何使用 使用的npm包为genny,npm 安装genny,使用 node -harmony 文件(-harmony 为使用es6属性启动参数) 启动项目 var genny= require( ...
- RedHat 和 Mirantis OpenStack 产品的版本和功能汇总和对比(持续更新)
Mirantis 和 Red Hat 作为 OpenStack 商业化产品领域的两大领军企业,在行业内有重要的地位.因此,研究其产品版本发布周期和所支持的功能,对制定 OpenStack 产品的版本和 ...
- background-attachment属性进阶
前提是定义了background-image属性,然后用background-attachment来指明背景图的位置是固定于视口的,还是随着包含块移动的.可简单理解为定义背景图片随滚动轴的移动方式. ...
- IT人士怎样的休息方式才高效
为什么你睡了11个小时仍然觉得疲累? 为什么你花了好几万去岛国度假并没有增加生活的热情? 都说要去KTV,去夜店,去游乐园就能忘掉不快,更带劲地开始新的一天,但是尽兴归来心里只剩空虚? 我们真的明白休 ...