javax.persistence.RollbackException: Error while committing the transaction
the valid jpa update entity code gives the exception below in the case of wrong dependency( org.hibernate, hibernate-core, 4.2.0.CR1)
entityManager.getTransaction().begin();
CompactDisc compactDisc = entityManager.find(CompactDisc.class, 7777);
compactDisc.setTitle("ZZZZZZZ");
entityManager.getTransaction().commit();
entityManager.close();
Exception in thread "main" javax.persistence.RollbackException: Error while committing the transaction
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:92)
at com.conygre.training.entities.LifecycleTester.main(LifecycleTester.java:25)
Caused by: java.lang.NullPointerException
at org.hibernate.ejb.event.EJB3PostUpdateEventListener.handlePostUpdate(EJB3PostUpdateEventListener.java:71)
at org.hibernate.ejb.event.EJB3PostUpdateEventListener.onPostUpdate(EJB3PostUpdateEventListener.java:67)
at org.hibernate.action.internal.EntityUpdateAction.postUpdate(EntityUpdateAction.java:248)
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:205)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:328)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1212)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:400)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:75)
As a resolution Change the version to to 4.1.9.Final or 3.6.10.Final
javax.persistence.RollbackException: Error while committing the transaction的更多相关文章
- 使用JPA保存对象时报nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly错误
使用JPA保存对象时报nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOn ...
- websphere部署 hibernate jpa & Error 500: javax/persistence/OneToOne.orphanRemoval()Z
WebSphere 7 & Javax/Persistence/OneToMany.OrphanRemoval() Error 文章出处:http://www.mkyong.com/websp ...
- Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Cannot open connection
Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceE ...
- Caused by: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode
进行 spring mvc jpa整合时.Junit方法测试时. 异常: org.springframework.beans.factory.BeanCreationException: Error ...
- Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index
1.错误描述 WARN:2015-05-01 16:45:37[main] - Exception encountered during context initialization - cancel ...
- Caused by: java.lang.ClassNotFoundException: javax.persistence.NamedStoredProcedureQuery
1.错误描述 2014-7-12 21:06:37 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreat ...
- Caused by: java.lang.ClassNotFoundException: javax.persistence.Entity
1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...
- Caused by: javax.persistence.NonUniqueResultException: result returns more than one elements
Caused by: javax.persistence.NonUniqueResultException: result returns more than one elements at org. ...
- java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
在使用 Hibernate 进行数据库操作的时候,在启动 Tomcat 服务器后,Console 控制台可能会打印出这样的异常:java.lang.NoClassDefFoundError: java ...
随机推荐
- tflearn tensorflow LSTM predict sin function
from __future__ import division, print_function, absolute_import import tflearn import numpy as np i ...
- java并发编程:线程安全管理类--原子操作类--AtomicIntegerFieldUpdater<T>
1.类 AtomicIntegerFieldUpdater<T> public abstract class AtomicIntegerFieldUpdater<T> exte ...
- 005PHP文件处理——目录操作,统计大小 filesize unlink
<?php /* 目录操作,统计大小 filesize unlink * */ $dir = dir("."); while (($file = $dir->read( ...
- $'\r': command not found in Cygwin
这是因为windows下的回车符改为Unix下的回车符,用以下命令可以批量修改. dos2unix ./*
- HDU 6153 A Secret(扩展kmp)
A Secret Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total ...
- 线程的同步之Synchronized的使用
一.介绍 线程的同步:一般的并发指的就是多个线程访问同一份资源.多个线程同时访问(修改)同一份资源的话,就会有可能造成资源数据有误. 如果多个线程访问多个不同资源,就不会造成线程同 ...
- 判断是否是iPhone5
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ...
- 原创:形象的讲解angular中的$q与promise
promise不是angular首创的,作为一种编程模式,它出现在……1976年,比js还要古老得多.promise全称是 Futures and promises.具体的可以参见 http://en ...
- nmcli 命令的基本使用
nmcli命令 地址配置工具:nmcli nmcli device 查看所有网卡的信息 nmcli device status 和numcli device 相同 nmcli device ...
- 第30课 C语言中的字符串
任意的软件开发过程都会涉及到字符串,字符串的概念: ca是字符数组,其他几个都是字符串,因为最后都有'\0'. 示例程序如下: #include <stdio.h> int main() ...