zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    将一个单向链表逆序
    高精度加法
    从反汇编的角度看引用和指针的区别
    冒泡排序
    josephus(约瑟夫)问题
    获取每个进程可打开的最大文件数量
    AIX免费终端的获取
    [转] Linux应用层的定时器Timer
    POD(plain old data)
    char与wchar_t的区别
  • 原文地址:https://www.cnblogs.com/sos-blue/p/3464646.html
Copyright © 2011-2022 走看看