Why are transactions not rolling back when using SpringJUnit4ClassRunner/MySQL/Spring/Hibernate

前端 未结 5 1248
谎友^
谎友^ 2021-02-06 16:04

I am doing unit testing and I expect that all data committed to the MySQL database will be rolled back... but this isn\'t the case. The data is being committed, even though my

5条回答
  •  深忆病人
    2021-02-06 17:01

    I hope I am right and that this is a simple one. You are missing the @Transactional annotation on your test class. This means that the test method itself isn't run in a transaction and thus there is nothing to roll back. Hope this helps.

提交回复
热议问题