java - How to make sure multiple DBs are transacted with a single transaction manager in spring? -


i using mulitple transaction managers (hibernatetransactionmanager) 1 each database.

during 1 code flow believe start/finish multiple transactions each database.

i want make sure database transactions part of single transaction. how can acheive this?

one of post here suggest use jtatransaction manager, should use in combination using hibernate?

although think in case of execption during phase of application, transactions rolled back.

i using spring 4.1.* , hibernate 3.6.* , not using webcontainer.

it years since worked hibernate, apologies in advance if of misleading.

  • you need jta transactions. datasources need support jta.
  • if running in web container weblogic or websphere, creating jta transaction easy. don't think tomcat suffice here. command line program, have not found answer.
  • if have full control on 3 databases, should fine. aware rollback on systems involve web services can patchy or require non-standard protocols (e.g. weblogic supports soap jta on t3 protocol)

if results, please share amount of advice in area minimal.

(edit)just noticed stated not using web container. if come across solution command line program, there lots of know. building junit tests distributed transactions want do, have never found how generate jta transaction object (/edit>)


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -