1 Reply Latest reply: Jul 31, 2014 11:07 AM by Tom Jenkinson RSS

Rollback not working -> also not in quickstart example

Mathias Hauser Newbie

Hi,

I have an issue right now in my framework related to not correct transactional behaviour in combination with hibernate.
What I want to achieve is a standalone framework which uses narayana-jta for the transaction management and hibernate for the persistence layer. But I encounter the problem that rollback does not work and I think Hibernate does not operate transactional, because I see changes in the DB before the transaction is commited. I thought that I may have an issue in my implementation so I checked out the example from quickstart/jta-and-hibernate at master · jbosstm/quickstart · GitHub which is bascially the same thing I do, except that I am not using Weld.
When I modify the TestCase class to use a msql db instead of an inmemory db and execute just the "testJpa" method I get the error that there isn't any transaction so I added transactionManager.begin() at the beginning of this method. After this everything runs without any error and if I look into my database the entries are there. Which shouldn't be the case because of the transactionManager.rollback() in the after() method.

 

Do I may understand something wrong?

 

Mathias Hauser

  • 1. Re: Rollback not working -> also not in quickstart example
    Tom Jenkinson Master

    Hi Mathias,

     

    It will be easier to help if you can provide a simple maven test case that demonstrates your issue. If you only have a single resource you won't need Narayana as hibernate supports local transactions I believe, if you have two resource managers on the other hand then I am sure we can point you at code to get it working if you can give a simple case to set us off.

     

    Thanks,

    Tom