Announcement Announcement Module
Collapse
No announcement yet.
multiple datasource with multiple sessionfactory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.
Working...
X