-->
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.  [ 1 post ] 
Author Message
 Post subject: Configure 2 HibernateTransactionManager and 2 SessionFactory
PostPosted: Wed Jun 18, 2014 12:35 am 
Newbie

Joined: Wed Jun 18, 2014 12:24 am
Posts: 1
Hi,

I am using spring4 and hibernate 4.
My application need to store data in two different databases. The access to the database are transactional, so I use @Transactional annotation.
However, transactions on database1 do not need to be aware of transactions on database2.
So I though I could just create two databasource bean, two sessionFactory bean and then create two different HibernateTransactionManager bean, each one against each sessionFactory.
The problem with that approach is that I get a UniqueBeanException, as the TransactionAspectSupport.determineTransactionManager is retrieving all beans implementing the PlatformTransactionManager and expects only one instance.

Basically, how could I configure my application, so that spring knows that for a sessionFactory1, it needs to use Manager1 and that for sessionFactory2, it needs to use Manager2 ?

Thanks and Regards,

Mel.


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

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.