引起:org.hibernate.HibernateException:找不到当前线程的Session

时间:2015-05-09 03:51:38

标签: spring hibernate

我有一个Hibernate项目作为CoreServices,具有所有Hibernate配置。我已经在我的另一个项目中导入了Project jar但是我正在

  

错误由以下原因引起:org.hibernate.HibernateException:未找到任何会话   当前线程

    <context:property-placeholder location="classpath:application.properties" />
    <context:annotation-config />
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${jdbc.driverClassName}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
</bean>
<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan">
        <list>
            <value>****.******.model</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql:false}</prop>
            <prop key="hibernate.format_sql">${hibernate.format_sql:false}</prop>
        </props>
    </property>
</bean>
<bean id="transactionManager"
    class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="persistenceExceptionTranslationPostProcessor"
    class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

0 个答案:

没有答案