Working with a map of hibernate session factories in a spring transaction system?

Spring's bernateTransactionManager doesn't support your case out of the box, because it can only manage a single SessionFactory.

Spring's bernateTransactionManager doesn't support your case out of the box, because it can only manage a single SessionFactory. So, you can have different transaction managers for different session factories, but then they cannot participate in the same transaction. If it's okay, see 10.5.6.2 Multiple Transaction Managers with @Transactional.

Otherwise, perhaps the easiest way to make your SessionFactories participate in a single transaction is to use JTATransactionManager with some standalone JTA implementation (Atomikos, Bitronix, JOTM). Also, note the concept of 1PC Optimization. I think JTA implementation should be able to apply it in your case in order to reduce overhead introduced by JTA.

Thanks for the info guys. I ended up solving it by detaching those sessionfactories from the transaction manager and managing the transactions manually. Bit more effort but it works.Thanks.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions