org.hibernate.PropertyValueException: not-null property references a null or transient value: model.
2018-03-02 12:27
555 查看
今天在写一个SSH整合的项目时,首先将数据库操作部分单独分离出来,写完后使用Junit进行測试,经过測试。发现没有不论什么问题,对数据库中的内容进行增删改查没有问题,可是将他整合到SSH的项目中时,报出了这么一个错误org.hibernate.PropertyValueException: not-null property references a null or transient value: model.TransactionRecord.remark。当时非常是费解,由于当时当时在Junit中測试的时候没有不论什么问题。可是将代码拷贝到项目中就会出错了呢。当时没有细致看错误堆栈信息,看到一个not
null就以为可能是參数传递时候出了错,然后在调用方法时将參数所有打印输出一遍,可是奇妙的是參数没有不论什么问题。那么问题来了,參数和方法都没有问题究竟是哪里错了呢?静下心来吧错误信息又一次阅读下面。错误的意思是在TransactionRecord这个类的remark属性是空。引发了这个异常,然后检查了一下映射文件,发如今映射文件里为remark这个属性设置了一个not-null属性为true,然后使用TransactionRecord时没有给remark赋值。
将remark的not-null属性去除或者给remark赋值后在执行。这个错误就消失了。
null就以为可能是參数传递时候出了错,然后在调用方法时将參数所有打印输出一遍,可是奇妙的是參数没有不论什么问题。那么问题来了,參数和方法都没有问题究竟是哪里错了呢?静下心来吧错误信息又一次阅读下面。错误的意思是在TransactionRecord这个类的remark属性是空。引发了这个异常,然后检查了一下映射文件,发如今映射文件里为remark这个属性设置了一个not-null属性为true,然后使用TransactionRecord时没有给remark赋值。
将remark的not-null属性去除或者给remark赋值后在执行。这个错误就消失了。
相关文章推荐
- org.hibernate.PropertyValueException: not-null property references a null or transient value: model.
- Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient va
- 错误:org.hibernate.PropertyValueException:not-null property references a null or transient value
- org.hibernate.PropertyValueException: not-null property references a null or transient value : xxx
- org.hibernate.PropertyValueException: not-null property references a null or transient value
- org.hibernate.PropertyValueException: not-null property references a null or transient value
- org.hibernate.PropertyValueException: not-null property references a null or transient value:
- org.hibernate.PropertyValueException: not-null property references a null or transient value
- not-null property references a null or transient value : org.com.model.person_one_one_test.address
- 关于hibernate(jpa)报not-null property references a null or transient value的问题
- hibernate级联保存问题,出错not-null property references a null or transient value
- hibernate异常:not-null property references a null or transient value
- Java开发中,试用hibernate建立关联时出现:not-null property references a null or transient value异常的原因
- 取数据 或 删除数据 DataIntegrityViolationException: not-null property references a null or transient value
- hibernate级联保存问题,出错not-null property references a null or transient value
- 错误:org.hibernate.PropertyValueException: not-null property references a null
- not-null property references a null or transient value
- not-null property references a null or transient value
- 关于:not-null property references a null or transient value
- not-null property references a null or transient value解决方案