Spring/JTA/JPA DAO integration test doesn't rollback?

前端 未结 2 791
逝去的感伤
逝去的感伤 2021-01-19 06:28

My DAO integration tests are failing because entities created during the tests are still in the database at the start of the next test. The exact same behavior is seen from

2条回答
  •  野的像风
    2021-01-19 07:31

    It turned out that my C3P0 JDBC data source was not XA aware and was therefore not participating in the transaction. Why I did not get an error, nor a warning in the log file, I do not know. Nonetheless, the reason you cannot use an XA aware data source is explained very nicely here. Note that the data source does not need to be XA capable...just XA aware.

    Replacing the C3P0 data source with the following one solved the problem.

    
            
            
            
            
            
            
            
    
    

提交回复
热议问题