Announcement Announcement Module
No announcement yet.
multiple datasource with multiple sessionfactory Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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 id="ttDataDao" class="com.DataDaoImpl">
    <property name="sessionFactory" ref="sessionFactory2" />

    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.