How do I create association between multiple databases or catalogs.
I have created two different session factories for two databases:
Code:
<bean id="objSessionFactory1" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="objDataSource1"/>
</property>
<property name="mappingResources">
<list>
<value>Test1.hbm.xml</value>
...
Code:
<bean id="objSessionFactory2" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="objDataSource2"/>
</property>
<property name="mappingResources">
<list>
<value>Test2.hbm.xml</value>
...
While creating association <many-to-one> I am getting error that
Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objSessionFactory2' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table refers to an unmapped class:
Please help as I need to use two different databases.