Bonjour,

j'ai développé une petite application avec Hibernate, spring et JSF qui permet de gérer des clients

bon au début j'ai réussi à générer automatiquement dans le runtime le schéma de ma base (1 table appelé CLIENT) en utilisant hibernate native sans Spring.

mais lorsque j'ai modifié le fichier Client.hbm.xml en ajoutant un champ(attribut ajouté dans l'entité Client) et j'ai intégré la couche Spring(j'ai ajouté les hibernateProperties dans applicationContext.xml), la modification de la table dans la base devient impossible

c'est ma fichier applicationContext.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
 
<?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"  
 default-autowire="byName"  
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd  
 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
	<!-- ========================= Hibernate Interceptor ========================= -->
	  <!-- Permet la gestion de la session hibernate par Spring -->
	  <bean id="hibernateInterceptor"
	        class="org.springframework.orm.hibernate3.HibernateInterceptor">
	    <property name="sessionFactory">
	      <ref bean="sessionFactorydscynamaf"/>
	    </property>
	  </bean>
 
	<!-- data source definition jdbc.properties -->
	<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  		<property name="location" value="WEB-INF/conf/jdbc.properties"/>
 	</bean>
	<bean id="dscynamaf" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName">
   			<value>${jdbc.driverClassName}</value>
  		</property>
  		<property name="url">
   			<value>${jdbc.url}</value>
  		</property>
  		<property name="username">
   			<value>${jdbc.username}</value>
  		</property>
  		<property name="password">
   			<value>${jdbc.password}</value>
  		</property>
	</bean>
 
 
 
	<!-- ENDd -->
 
 
	<bean id="sessionFactorydscynamaf" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref local="dscynamaf" />
		</property>
		<property name="mappingLocations">
       		<list>
         		<value>**/**/com/masociete/businessObject/Client.hbm.xml</value>
         	</list>
     	</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
				<prop key="current_session_context_class">thread</prop>
				<prop key="cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
			</props>
		</property>
	</bean>
	    <bean id="transactionManagerdscynamaf" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactorydscynamaf" />
		</property>
	</bean>
 
	<!-- Spring Data Access Exception Translator Defintion -->
<bean id="jdbcExceptionTranslator"
class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
<property name="dataSource">
<ref bean="dscynamaf" />
</property>
</bean>
 
<!-- Hibernate Template Defintion -->
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactorydscynamaf" />
</property>
<property name="jdbcExceptionTranslator">
<ref bean="jdbcExceptionTranslator" />
</property>
</bean>
 
	<!-- ========================= Start of DAO DEFINITIONS ========================= -->
<!-- TODO DAO Definition: Hibernate implementation -->
<bean id="clientDao" class="com.masociete.DAO.hibernateImpl.ClientDAOImpl">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
 
<!-- ========================= Start of SERVICE DEFINITIONS ========================= -->
<!-- Client Service Definition -->
<bean id="clientServiceTarget"
class="com.masociete.businessLayer.springImpl.ClientBLImpl">
<property name="daoClient">
<ref local="clientDao" />
</property>
</bean>
	<bean id="clientService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
	    <property name="transactionManager">
      		<ref local="transactionManagerdscynamaf"/>
    	</property>
    	<property name="target">
      		<ref local="clientServiceTarget"/>
    	</property>
		<property name="transactionAttributes">
	      <props>
	      	<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
	     	<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
	     	<prop key="save*">PROPAGATION_REQUIRED</prop>
	     	<prop key="update*">PROPAGATION_REQUIRED</prop>
	      </props>
	    </property>
	</bean>
 
 
	<!-- end idmc -->
 
</beans>
Si vous avez des idées ou des solutions à implémenter et merci d'avance !!