Announcement Announcement Module
Collapse
No announcement yet.
How to synchonize transactions between a jpa and jca transaction manager Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to synchonize transactions between a jpa and jca transaction manager

    Hello,

    I have a service which uses resources from spring`s jpa and jca transaction manager. Both of them are applied via two tx:advice, t.i.
    jpa transaction manager -> tx:advice one.
    jca transaction manager -> tx:advice two.

    I want both these two transaction managers to commit or rollback, depending on the outcome of my service.

    I do it now via setRollbackOnly on the DefaultTransactionDefinition, but this seems to rollback only one transaction manager - depending on the ordering of the tx:advice in application-context.xml, this is either the jpa or the jca transaction manager.

    Is there some way e.g. by using TransactionSynchronizationManager to bind these two transaction managers into one "logical" transaction?

  • #2
    You will have to use a single transaction manager. A transaction cannot spawn multiple transaction managers declared in Spring. You should consider using JTA transaction manager.

    Comment

    Working...
    X