HibernateInterceptor到底起到甚么作用?
<bean id="classDao" name="code"><bean id="classDao" name="code">public Object invoke(MethodInvocation methodInvocation) throws Throwable {boolean existingTransaction = false;Session session = SessionFactoryUtils.getSession(getSessionFactory(), getEntityInterceptor(), getJdbcExceptionTranslator());if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {logger.debug("Found thread-bound Session for Hibernate interceptor");existingTransaction = true;}else {logger.debug("Using new Session for Hibernate interceptor");if (getFlushMode() == FLUSH_NEVER) {session.setFlushMode(FlushMode.NEVER);}TransactionSynchronizationManager.bindResource(getSessionFactory(), new SessionHolder(session));}try {enableFilters(session);Object retVal = methodInvocation.proceed();flushIfNecessary(session, existingTransaction);return retVal;}catch (HibernateException ex) {throw convertHibernateAccessException(ex);}finally {disableFilters(session);if (existingTransaction) {logger.debug("Not closing pre-bound Hibernate Session after interceptor");}else {TransactionSynchronizationManager.unbindResource(getSessionFactory());SessionFactoryUtils.releaseSession(session, getSessionFactory());}}}