Test unitaire avec plusieurs sessionFactory
Bonjour,
Je doit utiliser dans un projet, deux schémas de la base de données. un schéma qui contient les tables du client, et le schéma propre à l'application (authentification et gestion de logs).
J'ai créé les deux sessionFactory et sessionFactory2 avec le format :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${my.hibernate.dialect}</prop>
<prop key="hibernate.hbm2ddl.auto">${my.hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.show_sql">${my.hibernate.show_sql}</prop>
</props>
</property>
</bean> |
Le code marche sans aucun problème, mais tous les test unitaires échouent, du fait que Junit n'accepte qu'une seule sessionFactory.
Citation:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory2' defined in class path resource [spring-datasource.xml]: Initialization of bean failed; nested exception is org.unitils.core.UnitilsException: More than one SessionFactory is configured in the spring configuration. This is not supported in Unitils
y'a t-il un moyen pour contourner ce problème?