org.hibernate.PropertyValueException: not-null property references a null or transient value: model.
今天在写一个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赋值后在执行。这个错误就消失了。
org.hibernate.PropertyValueException: not-null property references a null or transient value: model.的更多相关文章
- org.hibernate.PropertyValueException: not-null property references a null or transient value:
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.bj ...
- hibernate级联保存问题,出错not-null property references a null or transient value
Servlet.service() for servlet default threw exception org.hibernate.PropertyValueException: not-null ...
- hibernate添加数据时Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: com.javakc.hibernate.test.entity.TestEntity.testName
意思是,一个非null属性引用了一个null或瞬态值.就是在对应实体类配置文件hbm.xml中该属性配置了not-null="true",将其去掉即可.
- Confluence 6 "net.sf.hibernate.PropertyValueException: not-null" 相关问题解决
如果你遇到了下面的错误信息,例如: ERROR [Importing data task] [confluence.importexport.impl.ReverseDatabinder] endEl ...
- "net.sf.hibernate.PropertyValueException"
2019独角兽企业重金招聘Python工程师标准>>> 如果你遇到了下面的错误信息,例如: ERROR [Importing data task] [confluence.impor ...
- 【Hibernate】Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
今天用hibernate框架写crm项目时遇到报错: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' n ...
- 百度ueditor 实例化 Cannot set property 'innerHTML' of null 完美解决方案
此时此刻,我正在用博客园推荐的TinyMCE编辑器写这个博客,突然想起最近在项目中使用百度ueditor编辑器中的一些经历.所以记录在此,与大家分享. 不得不说,百度ueditor是一款很好的在线编辑 ...
- Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null
在开发Ext 项目中如果遇到 Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null 这个错误,检查下renderT ...
- Extjs4---Cannot read property 'addCls' of null
用MVC做后台管理系统时遇到的问题,关于tab关闭后再打开不显示,或者报错 我在新的tabpanel中加入了一个grid,当我关闭再次打开就会报错Cannot read property 'addCl ...
随机推荐
- web.xml里,classpath使用范围
比如说在web.xml里,配置spring监听. 在标签<param-value>里,classpath指向的配置文件路径应该是在config资源文件夹下的applicationConte ...
- Hadoop Hive概念学习系列之hive的脚本执行(二十)
相当一部分人,容易忽略hive脚本,其实,这在生产环境里,是非常重要的! $ hive -e "show tables" $ hive -e "show tables & ...
- Hibernate 延迟加载剖析与代理模式应用
本文来源于:http://www.ibm.com/developerworks/cn/java/j-lo-hibernatelazy/#icomments
- 查看/进入mac根目录的方式
1.通过“前往文件夹”快捷键组合 (1)打开finder,点击上部菜单栏“前往”,然后“个人”,直接跳转. (2)快捷键组合:command + shift + G:注意:打开finder后,再快捷键 ...
- jdbc 使用谨记
jdbc是java操作数据库的杀手锏.所有java程序员,对jdbc应该都不陌生. 但是,应该你也曾经被其折磨的抓耳挠腮,咬牙切齿吧,也许正因为这样你才对其记忆犹新,刻骨铭心. 这里有一些使用jdbc ...
- 【sqli-labs】 less51 GET -Error based -Order By Clause -String -Stacked injection(GET型基于错误的字符型Order By从句堆叠注入)
less50的字符型版本,闭合好引号就行 http://192.168.136.128/sqli-labs-master/Less-51/?sort=1';insert into users(id,u ...
- 自己写一个爬虫 copider
copider 模仿scrapy的一些写法,当然我这个是单进程的,不是异步的 1.目录 copider/copider.py #coding=utf-8 ''' Created on 2015年10月 ...
- 关于python中的property
python中的property在类实例化的时候 可以把类方法变成类属性使用, 还可以用在简化赋值上 1)不用property的时候,你的类可能是这样写的 2)用propery的时候你可能会这样写,调 ...
- (转) Hibernate检索方式概述
http://blog.csdn.net/yerenyuan_pku/article/details/70554816 Hibernate检索方式概述 我们在对数据库的操作中,最常用的是select, ...
- Spring处理自动装配的歧义性
1.标识首选的bean 2.使用限定符@Qualifier 首先在bean的声明上添加@Qualifier 注解: @Component @Qualifier("cdtest") ...