problème d'integration de hibernate dans spring
Bonsoir les amies. J'essaye d'intégrer hibernate à un projet spring existant mais j'y arrive pas.J'ai lu qu'il faut remplacer le fichier de configuration de hibernate par un bean dans le fichier contexte de l'application et c'est ce que j'ai fait.
applicationContext.xml:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<!-- the parent application context definition for the springapp application -->
<bean id="productManager" class="springapp.service.SimpleProductManager">
<property name="productDao" ref="productDao"/>
</bean>
<bean id="productDao" class="springapp.repository.JdbcProductDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<!--
<bean id="productDao" class="springapp.repository.p2">
</bean>
-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<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="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="exampleSessionFactory"
class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingLocations">
<list>
<value>
classpath:Product.hbm.xml
</value>
</list>
</property>
</bean>
</beans> |
je recois toujours une erreur 503. et quand j'enleve le bean exampleSessionFactory sa marche bien.
Merci d'avance pour vos réponses.