JUnit tests always rollback the transactions

后端 未结 7 1268
死守一世寂寞
死守一世寂寞 2020-12-05 02:54

I\'m running a simple JUnit test agains an application DAO. The problem is that I always get:

javax.persistence.RollbackException: Transaction marked as roll         


        
7条回答
  •  执笔经年
    2020-12-05 03:26

    1. add @Rollback on your Test class-level

    2. add @Transactional(value = "your_ManagerName",rollbackFor = Exception.class) on your test method

提交回复
热议问题