Hibernate with multiple databases
hello every one
I am very new to hibernate.I want to work with multiple databases.How it is possible?
I have read in the docs that i have to create multiple session factories .But i dont know how to do that?
Can anybody give me examples?
Thanks in Advance
Accessing two schema from spring and hibernate
Hi,
I am new to hibernate and Spring
My application use spring , struts and hibernate mapping. Its cuurently connecting to a single database
The requirement is to create a new schema and to fetch the data from both the schemas ….. I need to take data from both the schemas…. Both the schemas are having the same set of tables (Table names are same across the schemas as the new one is the archival schema )
In my dataAccessContext-jta.xml , datasource is defined as follows….
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc racle:thin:@someserver</value>
</property>
<property name="username">
<value>usrname</value>
</property>
<property name="password">
<value>passwd/value>
</property>
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
<constructor-arg>
<ref bean="dataSource"/>
</constructor-arg>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean"> <property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>trial.hbm.xml</value> </list> </property> <property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.O racle9Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.cache.region_prefix">hibernate.cach e</prop>
<prop key="hibernate.cache.provider_class"> net.sf.hibernate.cache.EhCacheProvider </prop> </props></property></bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate.Hibernate TransactionManager"> <property name="sessionFactory">
<ref local="sessionFactory"/>
</property> </bean>
My question is whether its possible to connect to two different schema s using hibernate … If so how can we go about it… Here we are usnig hibernate transaction manager .. Please explain in detail as I dont have any idea of how to go about it... Please help me in this…
Thanks