org.hibernate.AssertionFailure: null id in xxx.xx.xx的问题
- org.hibernate.AssertionFailure: null id in com.aa.TShoucang
null id,这个是什么回事呢?数据库是自动增长了,hibernate映射文件也一切正常的了,看了后台也打印出了insert into ....这个的语句了,但为什么就是插入不成功呢?
本着知之为知之,不知google之的精神,google了一下,都是说数据库与映射文件不对应,数据库设置了不为null,但hibernate里的映身文件设置了为null等等的.
发现都不是这个的问题,后来直接将打印出来的sql语句发送到数据库里执行一下,也是报一样的错,也就是说与hibernte没关系了.如以下这一句:
- insert into t_shoucang (url, describe, objic, userid, createuserid, createusername, createtime, updatetime, id) values ('aa', 'bb', 'cc', 'dd', 'ee', 'ff', '2010-01-01', '2010-01-01', 'abcd123');
发现describe这个字段变成了蓝色,是关键字,加多一个s后,再运行,OK了.
所以总结得出,null id这个问题时,有可能是字段里用到了数据库的关键字了.
今日又再出现这个问题了,并不是数据库关键字的原因了,如果数据库里设置了某个字段值不为null,而你保存的时候就设置了为null,也会报这个异常的。郁闷....
org.hibernate.AssertionFailure: null id in xxx.xx.xx的问题的更多相关文章
- org.hibernate.AssertionFailure: null id in xxx entry (don't flush the Session after an exception occurs)
网上找了很久,发现造成原因有很多种,后来终于发现了端倪:看提示是发生了异常,查看业务代码,发现有这个逻辑:先插入记录,如果有唯一键约束异常(并发造成),catch时查询已存在的记录,查询的时候就报了此 ...
- 报错:org.hibernate.AssertionFailure: null id in com.tt.hibernate.entities.News entry (don't flush the Session after an exception occurs)
在使用hibernate创建数据库的表格时,出现了如下报错: 十二月 28, 2016 10:17:02 上午 org.hibernate.tool.hbm2ddl.SchemaExport perf ...
- org.hibernate.AssertionFailure: null id in com.you.model.User entry (don't flush the Session after a
1.错误描写叙述 org.hibernate.AssertionFailure: null id in com.you.model.User entry (don't flush the Sessio ...
- org.hibernate.AssertionFailure: null id don't flus
我的是字段编码和数据库不匹配,是爬的微博数据
- org.hibernate.AssertionFailure: null id 错误
对象属性有Blob类型: 而Blob需在输入流中读取: InputStream in = new FileInputStream(url.getFile()); Blob bookPic = lobH ...
- null id in com.rocky.** entry 错误处理
1. 概述 使用hibernate往mysql数据库插入记录出错如下 10:37:57,364 ERROR [AssertionFailure] an assertion failure occure ...
- null id in entry (don't flush the Session after an exception occurs)
null id in entry (don't flush the Session after an exception occurs) 遇到这个异常实属不小心所致,最初看到异出的错误信息时我误认为是 ...
- 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 ...
随机推荐
- python中变量的缓存机制
同一文件中, 变量的缓存机制 (在此范围内的相同值内存地址一样) Number: int: -5 ~ 正无穷 float: 非负数 bool: ...
- 第1章 计算机网络和协议(3)_TCP/IP协议
3. TCP/IP协议 3.1 TCP/IP协议分层 3.2 TCP/IP通信过程 (1)应用层:浏览器和Web服务器是两个对等的实现,它们之间使用http协议进行通信. (2)传输层:网页传输之前, ...
- CentOS7 设置集群时间同步
1. 安装ntp时间同步工具 yum -y install ntp ntpdate #安装ntpdate时间同步工具 ntpdate cn.pool.ntp.org #设置时间同步 hwclock - ...
- Windows把内存变成快速虚拟硬盘
笔记本电脑安装了8G内存,却装了个Win7 32位系统,结果只能识别2946MB内存,还有5GB多内存白白浪费了,那个闹心啊,别提多不爽,听说能把内存虚拟成硬盘使用,用它缓存系统临时文件,以及缓存网页 ...
- solr 打分和排序机制(转载)
以下来自solr in action. 包含: 词项频次.查询词项出现在当前查询文档中的次数. 反向文档频次.查询词项出现在所有文档总的次数. 此项权重. 标准化因子: 字段规范: 文档权重. 字段权 ...
- 网络编程socket,详细讲述osi七层协议
一 网络编程 源方: 我们首先来说下数据在两台计算机之间的传递:操作系统控制着除应用层以外的四层 对于用户来说我们发数据一般都是在应用层,也就是我们是直接操作应用软件的,那么应用层要把数据传给传输层就 ...
- Struts2学习:interceptor(拦截器)的使用
对于需要登陆验证.权限验证等功能的网站,每一次请求,每一个action都写一段验证的代码,未免显得冗余且不易维护.struts2提供了拦截器interceptor,为这些页面提供一个切面,或者说公共组 ...
- pymongo
import pymongofrom bson import ObjectIdimport jsonmongo_client=pymongo.MongoClient(host='127.0.0.1', ...
- 数据库导入Excel
package com.cfets.ts.s.user.rest; import java.io.File; import java.io.FileInputStream; import java.i ...
- Structs 2 session 学习
后台获取 值类型 request.getSession().setAttribute("username", user.getUserName()); 对象类型 reque ...