To rollback or not to rollback
I have just read some comments in a Spanish group about how to test the persistence layer.
So far, I was happy using Spring Test Framework to roll back after each test. However, some people say that rolling back does not completely test the code. The book Growing Object Oriented Software says this about it:
A test that never commits does not fully exercise how the code under test interacts with the database. Neither can it test interactions between distinct transactions. Another disadvantage of rolling back is that the test discards data that might be useful for diagnosing failures
The alternative to rolling back is to create a well-known state of the database before each test using the builder pattern rather than DBunit, whose xml files are normally more difficult to maintain.