【问题标题】:Hibernate session not working in spring休眠会话在春季不起作用
【发布时间】:2013-05-07 11:57:10
【问题描述】:

我对 Spring 和 Hibernate 有一个非常奇怪的问题。 我已经配置了所有东西,我的 database.properties、hibernate.xml 和 datasource.xml 正如我在教程中看到的,但连接不起作用。

当我更改连接属性时,它不会改变任何东西。

我的hibernate.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<!-- Hibernate session factory -->
<bean id="sessionFactory" 
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

    <property name="dataSource">
      <ref bean="dataSource"/>
    </property>

    <property name="hibernateProperties">
       <props>
         <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
         <prop key="hibernate.show_sql">true</prop>
       </props>
    </property>

    <property name="packagesToScan">
        <list>
            <value>pl.devell.model</value>
        </list>
    </property>

</bean>

我的道课程正在运行,但没有返回任何结果。

【问题讨论】:

    标签: java spring hibernate connection dao


    【解决方案1】:

    我想通了。

    pl.devell.model 不是要扫描的包的正确名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多