解决方案 »

  1.   

    你用close或者clear方法关闭试试
      

  2.   


    session.flush(); 以下看看。
      

  3.   

    close肯定不行,currentSession commit 后自动关闭啊
      

  4.   

    你可以试试catch异常,出现异常的时候回滚事务,正常的话提交事务
      

  5.   

    Session sess =HibernateUtil.getSessionFactory().getCurrentSession();
     Transaction tx;
     try {
         tx = sess.beginTransaction();
         //do some work
         ...
         tx.commit();
     }
     catch (Exception e) {
         if (tx!=null) tx.rollback();
         throw e;
     }
     finally {
         sess.close();
     }
     
      

  6.   

    如果你是和spring集成了的话,那么可以在spring中配置事务回滚,如果没有,那么按照楼上哥们那样做如果你解决了,麻烦告诉一下解决方案,以前没有遇到过