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 ...
随机推荐
- 用Python一键搭建Http服务器的方法
用Python一键搭建Http服务器的方法 Python3请看 python -m http.server 8000 & Python2请看 python -m SimpleHTTPServe ...
- mysql视图的操作
一.创建视图的语法形式 CREATE VIEW view_name AS 查询语句 ; 使用视图 SELECT * FROM view_name ; 二.创建各种视图 1.封装实现查询常量语句的视图, ...
- iOS - UITableView 多选功能实现
:自定义Cell中的代码 #import <UIKit/UIKit.h> @interface TestCell : UITableViewCell @property(nonatomic ...
- es6杂记
es6杂记 let 和 const let 仅在代码块里有效 { let a = 10; var b = 1; } a // ReferenceError: a is not defined. b / ...
- linux,apache,mysql,php常用查看版本信息的方法
1. 查看linux的内核版本,系统信息,常用的有三种办法: uname -a; cat /proc/version; -bash-4.2$ uname -a Linux apphost -.el7. ...
- Puppeteer——自动化脚本设计
我被分配了一个繁琐的任务,就是要给100个相同的站点做同样的配置.曾经就有做过相同的事,那时还不会写脚本,全靠手动配置.机械的配置了两天的时间,身体感觉被掏空.所以这次我决定还是写一个脚本自动的进行配 ...
- js 性能调试
今天有幸偶遇我早就神往已久的性能调试问题. 原来js调试工具里面有可以记录每个方法的执行时间的功能,站在此功能的肩膀上就可以对自己的程序性能.瓶颈了如指掌,就可以针对性的,瞄准目标,斩草除根,以绝后患 ...
- C#斐波那契数列方法
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Cesium学习笔记(五):3D 模型 (http://blog.csdn.net/umgsoil/article/details/74572877)
Cesium支持3D模型,包括关键帧动画,皮肤的改变还有单个节点的选择等,Cesium还提供了了一个基于网络的工具,将COLLADA模型转换为glTF,方便和优化模型添加 还记得我们在实体添加的时候添 ...
- selenium之浏览器驱动
selenium需要配合浏览器的驱动使用,几个主要的浏览器驱动如下 浏览器 链接 Chrome https://sites.google.com/a/chromium.org/chromedriver ...