开启事务之前先判断事务是否已经打开,方法如下:
JdbcTransaction tx=(JdbcTransaction) session.beginTransaction();
改为JdbcTransaction tx = session.getTransaction().getLocalStatus()==LocalStatus.ACTIVE?(JdbcTransaction)session.getTransaction():(JdbcTransaction) session.beginTransaction();
时间: 2024-08-25 00:27:00