Guess your test cases are suposed to manipulate persistent data.
I found the following set-up userfull:
- Have a HiberanteTestCase which creates a SessionFactory once for the livetime of this test class. See the junit FAQ for more infos about this. If you want to run a lot of tests together do the same for a whole test suite. This saves you from initializing Hibernate for every single test.
- Use DBUnit to have a consistent DB. I found DBUnit hard to get working, but once you're through it, it's a very handy tool. I integrated DBUnit into my HibernateTestCase class.
- For convenience: Use a HibernateTransactionTemplate (visitor pattern), which saves you from doing the sam transaction handling stuff over and over again.
I'm using this set-up successfully withing eclipse with ~100 Testcases.
HTH
Ernst