} finally { TransactionSynchronizationManager.unbindResource(sessionFactory); doClose(session); } return result; } protected Session getSession(SessionFactory sessionFactory) { Session session = SessionFactoryUtils.getSession(sessionFactory, true); FlushMode flushMode = getFlushMode(); if (flushMode != null) { session.setFlushMode(flushMode); } return session; } private void doRollback(Session session, Transaction transaction) { logger.debug("数据库操作异常,开始回滚事务"); try { transaction.rollback(); logger.debug("回滚事务成功!"); } catch (Exception e) { logger.error("回滚事务失败!"); throw new WorkflowException("回滚事务失败!"); } finally { session.clear(); } } private void doClose(Session session) { logger.debug("开始关闭连接"); try { session.close(); } catch (Exception e) { logger.error( |