-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Can HibernateTransactionManager manage two sessionfactory
PostPosted: Tue Dec 11, 2007 9:21 pm 
Newbie

Joined: Wed Jan 31, 2007 9:55 pm
Posts: 16
Currently, the application has two sessionfactory for online tables and history tables


<bean id="oracleSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="foxDS"/>
<property name="mappingResources">
<list>
<value>OrderVO.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.format_sql=true
hibernate.show_sql=false
</value>
</property>
</bean>

<bean id="historySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="foxDS"/>
<property name="mappingResources">
<list>
<value>OrderVO_Hist.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.format_sql=true
hibernate.show_sql=false
</value>
</property>
</bean>


But, the transaction manager can reference to ONE sessionFactory only

<bean id="myTxManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="oracleSessionFactory"/>
</bean>

Therefore, is it possible to have the transaction manager handle TWO session factory? It is because the application will work on the online table and history table and would like to make the operation in a transaction, so that once roll-back, the operations on two session factory will be rolled back.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 12, 2007 9:23 am 
Beginner
Beginner

Joined: Tue Apr 24, 2007 12:53 pm
Posts: 28
Your question is best posed in the spring forums located here:

http://forum.springframework.org/

But to answer your question: No, HibernateTransactionManager can only manage the transactions of one session factory. If you need more functionality, ask in the spring forums how to pull it off. (Or read up on JTATransactionManager, which I think will work but I haven't used it myself.)

-B


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.