-
May 20th, 2010, 12:29 PM
#1
Spring SessionFactory and Hibernate 3.5 annotations
Question: Code worked perfectly with Hibernate annotations 3.4 but when I upgraded to hibernate annotations 3.5 the sessionFactory can not be created by Spring. How do I fix this? Here is my application-config.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" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
<property name="dataSource" ref="mysqlDataSource" />
<property name="packagesToScan">
<list>
<value>com.example</value>
<value>com.anotherexample</value>
</list>
</property>
</bean>
<bean id="mysqlDataSource"
class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/test" />
<property name="username" value="test" />
<property name="password" value="password" />
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.simple.Simple JdbcTemplate">
<constructor-arg ref="mysqlDataSource" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
</beans>
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules