java错误:org.hibernate.AssertionFailure: null id in xxx.xx.xx的问题

经常遇到这种问题,在添加数据的时候;

看到这种情况,你是不是容易想到配置问题?缓存问题?主键问题?

不过一般只要不是新项目,而且主键已经配置了自动增长,那么就是其它问题了。

以下就是我遇到过的比较坑人的现象,但往往不会想到这方面,浪费不少时间;

1、做添加功能时,因为新加了个字段,结果数据库的字段忘了添加,然后就报这错;

2、数据库字段和代码中配置类型没有匹配(比如价格在数据库中是个double,代码中写了个String);

时间: 2024-08-27 11:57:03

java错误:org.hibernate.AssertionFailure: null id in xxx.xx.xx的问题的相关文章

org.hibernate.AssertionFailure: null id in xxx.xx.xx的问题

今日在开发时遇到一个比较奇怪的问题,保存时报这个异常: Java代码   org.hibernate.AssertionFailure: null id in com.aa.TShoucang null id,这个是什么回事呢?数据库是自动增长了,hibernate映射文件也一切正常的了,看了后台也打印出了insert into ....这个的语句了,但为什么就是插入不成功呢? 本着知之为知之,不知google之的精神,google了一下,都是说数据库与映射文件不对应,数据库设置了不为null,

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 Session after an exception occurs) at org.hibernate.event.internal.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:77) at org.hib

org.hibernate.AssertionFailure: null id don‘t flu

严重: Servlet.service() for servlet default threw exceptionorg.hibernate.AssertionFailure: null id in com.iprecare.entity.Inventroyrecord entry (don't flush the Session after an exception occurs)    at org.hibernate.event.def.DefaultFlushEntityEventLis

org.hibernate.AssertionFailure: null id 错误

对象属性有Blob类型: 而Blob需在输入流中读取: InputStream in = new FileInputStream(url.getFile()); Blob bookPic = lobHelper.createBlob(in, in.available()); book.setBookPic(bookPic); book2.setBookPic(bookPic); 如对象bookPic第二次使用的时候以无法再从in 中读取信息,因此报错 改进方法: 重新获取一次in 或使用 in.

Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference xxx 的问题分析与解决方案

最近,公司要求开发一个APP,所以很苦逼的学习了几天 Android 的上手手册,但是实际运用于开发中还是捉襟见肘,困难重重:好在的是,部门还有几个专门搞安卓的大佬可以问问,哈哈 好了,进入今天的正题吧,前天开发过程中,遇到一个如“标题”所示的问题,百思不得其解!最终上网搜报错的原因,才找到问题的所在:.xml文件中运用到了不存在的标签--我的是因为粗心把<View>写成了<view>,加载的时候找不到该标签,所以页面一直运行不出来. 所以,该问题基本出在于布局页面有错(有的错误页

Java学习笔记--Hibernate框架错误集合及解决

错误1:MappingException: Unknown entity解决方案 http://jingyan.baidu.com/article/e75aca8552761b142edac6cf.html 错误2:Could not bind factory to JNDI 2006-07-23 23:14:53,796 [main] WARN org.hibernate.impl.SessionFactoryObjectFactory - Could not bind factory to

org.hibernate.TypeMismatchException: Provided id of the wrong type for class cn.itcast.entity.User. Expected: class java.lang.String, got class java.lang.Integer at org.hibernate.event.internal.Defau

出现org.hibernate.TypeMismatchException: Provided id of the wrong type for class cn.itcast.entity.User. Expected: class java.lang.String, got class java.lang.Integer at org.hibernate.event.internal.DefaultLoadEventListener.checkIdClass(DefaultLoadEvent

解决mac os x下 tomcat启动报 java.net.BindException: Permission denied &lt;null&gt;:80 错误

我在mac os x上启动tomcat的时候,报 java.net.BindException: Permission denied <null>:80,java.net.BindException: Permission denied <null>:443错误,443时因为我要弃用ssl服务. Mac OS X 因为要绑定1024以下的端口需要ROOT权限, 但是如果用root权限启动eclipse或tomcat又会造成, 启动创建的各类文件是root的,普通用户无法删除. 为此

java框架篇---hibernate之缓存机制

一.why(为什么要用Hibernate缓存?) Hibernate是一个持久层框架,经常访问物理数据库. 为了降低应用程序对物理数据源访问的频次,从而提高应用程序的运行性能. 缓存内的数据是对物理数据源中的数据的复制,应用程序在运行时从缓存读写数据,在特定的时刻或事件会同步缓存和物理数据源的数据. 二.what(Hibernate缓存原理是怎样的?)Hibernate缓存包括两大类:Hibernate一级缓存和Hibernate二级缓存. 1.Hibernate一级缓存又称为“Session的