Announcement Announcement Module
Collapse
No announcement yet.
Spring + Atomikos + XA + Hibernate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring + Atomikos + XA + Hibernate

    Versions :
    Atomikos 3.1.5
    Hibernate 3.2.3
    Spring 2.0.2
    2 databases instances accessed using XaPool 1.5

    I've trouble with distributed transactions. I'm running in a Spring managed context (not in a JEE container).
    When I start updating datas on the 2 databases I've a rollback before the end of the transaction on every connections.
    Using P6Spy to log SQL statement, here is how it runs.

    2007/07/12_17:07:11.298|78|7|statement|update dbo.
    2007/07/12_17:07:11.517|31|7|statement|select ... from dbo.
    ...
    2007/07/12_17:07:11.658|0|3|statement|update dbo.
    2007/07/12_17:07:11.673|0|3|statement|select ... from dbo.
    ...
    2007/07/12_17:07:12.657|93|7|rollback||
    2007/07/12_17:07:13.064|203|3|rollback||
    2007/07/12_17:07:13.204|93|7|commit||
    2007/07/12_17:07:13.251|0|3|commit||



    The problem is
    When debugging I found that the problem is related to Hibernate:
    At the end of the use of a transaction, Hibernate fires the TransactionSynchronizationAdapter.beforeCompletion.
    Then it calls TransactionSynchronizationManager.unbindResource on the factory.
    The result is a close on the connection (Here is the part liked with Datasource, whatever it is).
    But we are before completion so there was no commit or rollback before!

    What I understand form that thread execution is there is a misunderstanding between Atomikos and Hibernate.
    Hibernate may not "see" the transaction managed by Atomikos or something like that.

    So, in my opinion, it's a trouble on my Hibernate/Atomikos configuration.
    When I understood that I started looking for a sample configuration that suites my needs and couldn't find something working.
    That is the reason why I asked for help here.

    Help!
    What's wrong with the configuration above?

    Configuration quotes are attached with this post
Working...
X