-
Jan 18th, 2012, 08:39 PM
#1
multiple datasource with multiple sessionfactory
Spring 3.1 + hibernate4
1. created two datasources with different database.
2. both session factories are defined as follows :
<bean id="tttUserDao" class="com.UserDaoImpl">
<property name="sessionFactory" ref="sessionFactory1" />
</bean>
<bean id="ttDataDao" class="com.DataDaoImpl">
<property name="sessionFactory" ref="sessionFactory2" />
</bean>
I got the error as follows :
nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException:
No unique bean of type [org.hibernate.SessionFactory] is defined: expected single
matching bean but found 2: [sessionFactory1, sessionFactory2]
Note : the same design is working fine with single session factory/one datasource.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules