[英]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.