Spring DAO Unit Testing access to connection
Springers,
I am trying to write unit tests for my Spring enhanced Hibernate DAOs. I am using DBUnit and AbstractTransactionalDataSourceSpringContextTests.
Now, I subscribe to the speed benefits of always rolling back unit tests (not integration - got to be able to test optimistic locking, etc). But, I am having issues coming up with a nice design to access the connection that Hibernate is using so that I can perform DBUnit assertions against my database within the same connection.
An alternative would be to let the transaction commit and then do the DBUnit assertions in another connection but that defeats the rollback gains.
Any thoughts would be appreciated greatly.
<p.s.> If Hibernate and Spring were chicks, they'd both be hot. So, I hope Hibernate starts being nice to the new hot chick in town.
Thanks
Joe Witt