IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

Génération de la base après l'intégration de Spring devient impossible


Sujet :

Hibernate Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de clubist
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2008
    Messages
    217
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Février 2008
    Messages : 217
    Par défaut Génération de la base après l'intégration de Spring devient impossible
    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 !!

  2. #2
    Membre expérimenté Avatar de DarkMolo
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    207
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : Maroc

    Informations forums :
    Inscription : Juillet 2006
    Messages : 207
    Par défaut
    Salut,

    clubist dit:
    ...la modification de la table dans la base devient impossible.
    Est ce que t'es sûr que ton objet sessionFactorydscynamaf ait été instancié, tu as un message d'erreur ou juste rien qui se passe ?

Discussions similaires

  1. Réponses: 2
    Dernier message: 22/09/2007, 17h38
  2. Réponses: 3
    Dernier message: 08/02/2007, 22h14
  3. Sécurité sur une base après avoir suivi le tutoriel
    Par laurent.w dans le forum Sécurité
    Réponses: 1
    Dernier message: 16/01/2007, 19h05
  4. [ASE]saturation de la base après requête
    Par m@estro dans le forum Sybase
    Réponses: 3
    Dernier message: 05/10/2006, 19h16
  5. blocage base après importation d'un module
    Par voodoo dans le forum Access
    Réponses: 3
    Dernier message: 13/10/2004, 15h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo