![](/img/trans.png)
[英]autowire hibernate session with spring 3 and hibernate 4
[英]Hibernate session not working in spring
我对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>
我的Dao类正在运行,但未返回任何结果。
我想到了。
pl.devell.model不是要扫描的软件包的正确名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.