Reputation: 185
I run my test case with @Transactional annotation. In one of my test methods I do something in service layer and this results in storing a new row in the database. But when I want to use that row in same method (just to test the integrity of the data put in the database) it cannot be found. I suppose the database never gets updated before the method ends? How to make this work?
Thanks!
Upvotes: 0
Views: 223
Reputation: 3067
Add isolation level to the @Transactional attribute as
@Transactional(isolation=Isolation.READ_UNCOMMITTED)
That will allow the uncommitted reads from the database that the test is currently not seeing.
Upvotes: 1