Bonjour,
Je suis actuellement en train de développer un portail de suivi de production, j'ai donc une base de production ou sont stockés mes infos à exploiter, ainsi qu'une deuxième base contenant mes infos liées au portail(compte utilisateur...).
Pour des raisons de sécurité liées au client je n'ai pas le droit d'écrire des infos sur la base de prod d'ou la deuxième base.
Mon problème est le suivant je n'arrive pas à spécifier 2 datasources différentes pour mon appli, voila mon fichier de config actuel :
Je pense ne pas etre trop loin de la solution ... mais je ne trouve pas. Pour info j'utilise la version 3 d'hibernate avec les annotations
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 <!-- DAO layer --> <tx:annotation-driven transaction-manager="transactionManager1"/> <!-- <tx:annotation-driven transaction-manager="transactionManager2"/> --> <bean id="transactionManager1" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- <bean id="transactionManager2" --> <!-- class="org.springframework.orm.hibernate3.HibernateTransactionManager"> --> <!-- <property name="sessionFactory" ref="sessionFactoryOracle" /> --> <!-- </bean> --> <!-- Hibernate datasource --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/portail" /> <property name="username" value="root" /> <property name="password" value="" /> </bean> <!-- <bean id="dataSourceOracle" class="org.apache.commons.dbcp.BasicDataSource" --> <!-- destroy-method="close"> --> <!-- <property name="driverClassName" value="com.mysql.jdbc.Driver" /> --> <!-- <property name="url" value="jdbc:mysql://localhost:3306/test" /> --> <!-- <property name="username" value="root" /> --> <!-- <property name="password" value="" /> --> <!-- </bean> --> <!-- Hibernate session factory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="packagesToScan" value="server.entity" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <!-- <bean id="sessionFactoryOracle" --> <!-- class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> --> <!-- <property name="dataSource" ref="dataSourceOracle" /> --> <!-- <property name="packagesToScan" value="server.indicator" /> --> <!-- <property name="hibernateProperties"> --> <!-- <props> --> <!-- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> --> <!-- <prop key="hibernate.hbm2ddl.auto">update</prop> --> <!-- <prop key="hibernate.show_sql">true</prop> --> <!-- </props> --> <!-- </property> --> <!-- </bean> -->
Merci d'avance.
Cordialement,
Cleytus
Partager