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

Spring Java Discussion :

[Hibernate] Utilisation de deux session différente


Sujet :

Spring Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Janvier 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 7
    Par défaut [Hibernate] Utilisation de deux session différente
    Bonjour à tous,

    je voudrais mettre deux dataSources dans mon fichier de configuration Spring, je voudrais savoir si c'est possible si oui comment pourrais je le faire.

    merci d'avance.

  2. #2
    Membre éprouvé
    Avatar de David Gimelle
    Profil pro
    Développeur Java
    Inscrit en
    Janvier 2007
    Messages
    79
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Janvier 2007
    Messages : 79
    Par défaut
    suffit de declarer 2 dataSources avec des noms differents dans les fichiers de conf de spring.

    David Gimelle
    Developpeur J2ee
    blog: Http://getj2ee.over-blog.com

  3. #3
    Nouveau membre du Club
    Inscrit en
    Janvier 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 7
    Par défaut
    et dans le sessionFactory je dois mettre mes deux data sources? pourrais tu me donner un exemple.

  4. #4
    Membre éprouvé
    Avatar de David Gimelle
    Profil pro
    Développeur Java
    Inscrit en
    Janvier 2007
    Messages
    79
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Janvier 2007
    Messages : 79
    Par défaut
    tu surement va devoir definir 2 sessionFactory.

    Est-ce que tu peux montrer ton fichier de config ?

    David Gimelle
    Developpeur J2ee
    blog: Http://getj2ee.over-blog.com

  5. #5
    Nouveau membre du Club
    Inscrit en
    Janvier 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 7
    Par défaut
    oui biensur:

    Code xml : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Application context for AlimCpt testing -->
     
    <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="
    	   <a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schem...-beans-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a> <a href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schem...ing-tx-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
     
     
    	<bean id="anetoVueCotisationEncaissement"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementImpl">
    		<property name="anetoVueCotisationEncaissementDAO">
    			<ref bean="anetoVueCotisationEncaissementDAO" />
    		</property>
    	</bean>
     
    	<bean id="anetoVueCotisationEncaissementDAO"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementDAOImpl">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<bean id="dataSource"
    		class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName"
    			value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url"
    			value="jdbc:oracle:thin:@frtlr210.soltim:1521:ANETO51" />
    		<property name="username" value="I4UD17_USER" />
    		<property name="password" value="I4UD17_USER" />
    	</bean>
     
     
     
    	<bean id="txManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
     
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
     
    	<!-- enable the configuration of transactional behavior based on annotations -->
    	<!--tx:annotation-driven transaction-manager="txManager"/-->
    </beans>

  6. #6
    Nouveau membre du Club
    Inscrit en
    Janvier 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 7
    Par défaut
    j'ai essayé ce que tu m'as dis et ça me donne toujours une exception, voici mon nouveau fichier de conf spring:
    Code xml : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Application context for AlimCpt testing -->
     
    <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="
    	   <a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schem...-beans-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a> <a href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schem...ing-tx-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
     
     
    	<bean id="anetoVueCotisationEncaissement"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementImpl">
    		<property name="anetoVueCotisationEncaissementDAO">
    			<ref bean="anetoVueCotisationEncaissementDAO" />
    		</property>
    	</bean>
     
    	<bean id="anetoVueCotisationEncaissementDAO"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementDAOImpl">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<bean id="dataSource"
    		class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName"
    			value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url"
    			value="jdbc:oracle:thin:@frtlr210.soltim:1521:ANETO51" />
    		<property name="username" value="I4UD17_USER" />
    		<property name="password" value="I4UD17_USER" />
    	</bean>
     
    /******************AnetoVueComptablesCommun*****************/
    	<bean id="anetovuescomptablescommun"
    		class="com.npfo.comptabilite.business.common.anetovuescomptablescommun.AnetoVuesComptablesCommunImpl">
    		<property name="AnetoVuesComptablesCommunDao">
    			<ref bean="AnetoVuesComptablesCommunDao" />
    		</property>
    	</bean>
     
    	<bean id="AnetoVuesComptablesCommunDao"
    		class="com.npfo.comptabilite.business.common.anetovuescomptablescommun.AnetoVuesComptablesCommunDaoImpl">
    		<property name="dataSourceComCom">
    			<ref bean="dataSourceComCom" />
    		</property>
    	</bean>
     
    	<bean id="dataSourceComCom"
    		class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName"
    			value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url"
    			value="jdbc:oracle:thin:@frtlr210.soltim:1521:ANETO51" />
    		<property name="username" value="I4UD17_OWNER" />
    		<property name="password" value="I4UD173403" />
    	</bean>
     
    	<bean id="txManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
     
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
     
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSourceComCom">
    			<ref bean="dataSourceComCom" />
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
     
    	<!-- enable the configuration of transactional behavior based on annotations -->
    	<!--tx:annotation-driven transaction-manager="txManager"/-->
    </beans>

  7. #7
    Membre Expert
    Homme Profil pro
    Inscrit en
    Septembre 2006
    Messages
    2 963
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 2 963
    Par défaut
    2 beans avec le même id="sessionFactory"…

  8. #8
    Nouveau membre du Club
    Inscrit en
    Janvier 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 7
    Par défaut
    j'ai réctifié mon fichier de conf spring, et j'ai toujours la même exception

    Code xml : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Application context for AlimCpt testing -->
     
    <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="
    	   <a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schem...-beans-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a> <a href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schem...ing-tx-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
     
     
    	<bean id="anetoVueCotisationEncaissement"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementImpl">
    		<property name="anetoVueCotisationEncaissementDAO">
    			<ref bean="anetoVueCotisationEncaissementDAO" />
    		</property>
    	</bean>
     
    	<bean id="anetoVueCotisationEncaissementDAO"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementDAOImpl">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<bean id="dataSource"
    		class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName"
    			value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url"
    			value="jdbc:oracle:thin:@frtlr210.soltim:1521:ANETO51" />
    		<property name="username" value="I4UD17_USER" />
    		<property name="password" value="I4UD17_USER" />
    	</bean>
     
    /******************AnetoVueComptablesCommun*****************/
    	<bean id="anetovuescomptablescommun"
    		class="com.npfo.comptabilite.business.common.anetovuescomptablescommun.AnetoVuesComptablesCommunImpl">
    		<property name="AnetoVuesComptablesCommunDao">
    			<ref bean="AnetoVuesComptablesCommunDao" />
    		</property>
    	</bean>
     
    	<bean id="AnetoVuesComptablesCommunDao"
    		class="com.npfo.comptabilite.business.common.anetovuescomptablescommun.AnetoVuesComptablesCommunDaoImpl">
    		<property name="dataSource">
    			<ref bean="dataSourceComCom" />
    		</property>
    	</bean>
     
    	<bean id="dataSourceComCom"
    		class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName"
    			value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url"
    			value="jdbc:oracle:thin:@frtlr210.soltim:1521:ANETO51" />
    		<property name="username" value="I4UD17_OWNER" />
    		<property name="password" value="I4UD173403" />
    	</bean>
     
    	<bean id="txManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    		<property name="sessionFactory" ref="sessionFactoryCom" />
    	</bean>
     
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
     
    	<bean id="sessionFactoryCom"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSourceComCom" />
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
     
    	<!-- enable the configuration of transactional behavior based on annotations -->
    	<!--tx:annotation-driven transaction-manager="txManager"/-->
    </beans>

  9. #9
    Membre Expert
    Homme Profil pro
    Inscrit en
    Septembre 2006
    Messages
    2 963
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 2 963
    Par défaut
    un HibernateTransactionManager avec 2 property sessionFactory ?

  10. #10
    Membre éprouvé
    Avatar de David Gimelle
    Profil pro
    Développeur Java
    Inscrit en
    Janvier 2007
    Messages
    79
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Janvier 2007
    Messages : 79
    Par défaut
    Il faut aussi 2 transactions managers differents. Et puis 2 Dao differents ou 2 methodes differentes dans un seul Dao avec 2 Transaction manager.

    David Gimelle
    Developpeur J2EE
    blog: http://getj2ee.over-blog.com

  11. #11
    Nouveau membre du Club
    Inscrit en
    Janvier 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 7
    Par défaut
    je comprends pas, où est ce que je devrais mettre mes deux DAOs, pourrais tu me dire où est ce que je dois modifier dans mon fichier de configuration spring, merci beaucoup

  12. #12
    Membre éprouvé
    Avatar de David Gimelle
    Profil pro
    Développeur Java
    Inscrit en
    Janvier 2007
    Messages
    79
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Janvier 2007
    Messages : 79
    Par défaut
    Est-ce que tu peux nous montrer un bout de ta dao. Par exemple la methode qui te permet de persister un objet?

  13. #13
    Nouveau membre du Club
    Inscrit en
    Janvier 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 7
    Par défaut
    voici le corps de mon fichier de conf,

    Code xml : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Application context for AlimCpt testing -->
     
    <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="
    	   <a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schem...-beans-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a> <a href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schem...ing-tx-2.5.xsd</a>
    	   <a href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
     
     
    	<bean id="anetoVueCotisationEncaissement"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementImpl">
    		<property name="anetoVueCotisationEncaissementDAO">
    			<ref bean="anetoVueCotisationEncaissementDAO" />
    		</property>
    	</bean>
     
    	<bean id="anetoVueCotisationEncaissementDAO"
    		class="com.npfo.comptabilite.business.anetovuecotisationencaissement.AnetoVueCotisationEncaissementDAOImpl">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<bean id="dataSource"
    		class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName"
    			value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url"
    			value="jdbc:oracle:thin:@frtlr210.soltim:1521:ANETO51" />
    		<property name="username" value="I4UD17_USER" />
    		<property name="password" value="I4UD17_USER" />
    	</bean>
     
    /******************AnetoVueComptablesCommun*****************/
    	<bean id="anetovuescomptablescommun"
    		class="com.npfo.comptabilite.business.common.anetovuescomptablescommun.AnetoVuesComptablesCommunImpl">
    		<property name="AnetoVuesComptablesCommunDao">
    			<ref bean="AnetoVuesComptablesCommunDao" />
    		</property>
    	</bean>
     
    	<bean id="AnetoVuesComptablesCommunDao"
    		class="com.npfo.comptabilite.business.common.anetovuescomptablescommun.AnetoVuesComptablesCommunDaoImpl">
    		<property name="dataSource">
    			<ref bean="dataSourceComCom" />
    		</property>
    	</bean>
     
    	<bean id="dataSourceComCom"
    		class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName"
    			value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url"
    			value="jdbc:oracle:thin:@frtlr210.soltim:1521:ANETO51" />
    		<property name="username" value="I4UD17_OWNER" />
    		<property name="password" value="I4UD173403" />
    	</bean>
     
    	<bean id="txManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
     
     
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
     
     
    	<bean id="txManagercom"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactoryCom" />
    	</bean>
     
    	<bean id="sessionFactoryCom"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSourceComCom" />
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
     
    	<!-- enable the configuration of transactional behavior based on annotations -->
    	<!--tx:annotation-driven transaction-manager="txManager"/-->
    </beans>

    merci

  14. #14
    Membre éprouvé
    Avatar de David Gimelle
    Profil pro
    Développeur Java
    Inscrit en
    Janvier 2007
    Messages
    79
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Janvier 2007
    Messages : 79
    Par défaut
    Est-ce que tu peux nous montrer un bout du code Java de ta dao. Par exemple la methode qui te permet de persister un objet?

  15. #15
    Membre éprouvé
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    143
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 143
    Par défaut
    Si tu as deux bases de données il te faut en effet tout dupliquer : deux sessionFactory Hibernate, par exemple.

    A priori chaque DAO devrait n'utiliser qu'une seule base de données, donc cela ne devrait pas te poser de problème.

    Par contre, si tu veux deux instances d'une même classe DAO, qui utilisent chacune une des deux bases de données : il te faut alors déclarer deux fois ton bean Spring DAO.... La bonne nouvelle c'est qu'on peut faire de l'héritage de configuration Spring, ce qui fait que cela ne devrait pas être trop fastidieux.

    Attention cependant :

    - Je vois que tu bosses pour Soltim (sympa de poster ton login/mot de passe!), et chez Cegedim vous avez une méthode que je qualifierais de "très particulière" de traiter les DAOs. Bref, je ne te garanti pas que ça fonctionne avec le framework maison (pour info, je suis un ancien du CETIP, qui a fusionné avec vous pour faire Cegedim Activ)

    - A mon avis ce que tu vas vraiment vouloir faire ce sont des transactions distribuées entre tes 2 bases de données : mauvaise nouvelle, cela va être compliqué... La meilleure manière de faire pour toi serait de faire des synonymes d'une base dans l'autre base : ainsi, au niveau du Java, tu ne verrais qu'une seule base de données, et uniquement des transactions locales. Cela résoudrait tes problèmes. Il y a beaucoup de sociétés qui interdisent cela, mais chez Cegedim ça devrait passer, à moins que les choses n'aient beaucoup changées depuis l'époque

Discussions similaires

  1. Utilisation de deux bibliothèques différentes pour le cryptage RSA --> impossible ?
    Par Djobird dans le forum Algorithmes et structures de données
    Réponses: 2
    Dernier message: 26/01/2011, 17h25
  2. Réponses: 2
    Dernier message: 10/05/2010, 09h41
  3. Utilisation de deux sessions
    Par gazelle dans le forum Langage
    Réponses: 2
    Dernier message: 21/02/2008, 16h35
  4. Réponses: 5
    Dernier message: 23/03/2007, 13h22
  5. Réponses: 8
    Dernier message: 13/03/2006, 17h37

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