Hibernate Cannot open session

1.前段请求spring mvc controller 接口提示cannot open session

解决方法配置一个视图的拦截器,访问页面的时候被filter拦截开启session
<filter>
    <filter-name>openEntityManagerInView</filter-name>
    <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
    <init-param>
        <param-name>sessionFactoryBeanName</param-name>
        <param-value>sessionFactory</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>openEntityManagerInView</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>

2.spring service 访问repository, 接口中注入的sessionFactory 无法开启session

在commonRepository 中访问接口调用数据库的时候无法开启session 
错误信息:Spring Hibernate Could not obtain transaction synchronized Session for current thread
    <bean id="commonRepository" class="com.derbysoft.common.repository.CommonRepository">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>

    <bean id="autoDaoProxyCreator" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
        <property name="interceptorNames">
            <list>
                <value>systemInterceptor</value>
            </list>
        </property>
    </bean>

    <bean id="systemInterceptor" class="com.derbysoft.common.hibernate.HibernateInterceptor">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>