Unit Testing Your Database Code with Hibernate and Spring

You’ve got database code that uses both Hibernate and Spring. You need to test it. In this podcast I talk about how you can use DBUnit and HSQLDB along with some Spring test classes to create a setup that will let you test database code fast, and in isolation. Just what good unit tests should do.

Check out some great references on database testing, including the ones I mentioned in this show.

DBUnit and thier best practices for database testing.
The HSQLDB home page.
Scott Ambler’s excellent discussion of database refactoring.
An article from TheServerSide.com about unit testing with HSQLDB.
Spring’s AbstractTransactionalDataSourceSpringContextTests class that helps make some of your database testing easier. Check the other classes in the hierarchy for specifics on what they do as well.

I decided to try out adding a GarageBand.com song today, like the SlashdotReview podcast does. The song is Calendar by Eugenia and The Boys. Let me know if you like it. Also feel free to revolt and tell me to pull the music and keep it to tech stuff. :-)

Listen now with the Flash player.

Download Unit Testing Database Code.

4 Responses to “Unit Testing Your Database Code with Hibernate and Spring”

  1. Chris Says:

    Tim, haven’t had a dose of Zdot for several weeks. A new one in the pipeline? Love listening to these on the way to and fro work.

    Keep up the good work.

  2. Jared Says:

    I did not know Zdot was back up!! And with a podcast. This is fantastic!! I’m downloading them all just so I can catch up.

  3. Anthony Says:

    I really enjoy your podcast. JavaCast sucks in comparison.

  4. Tony Lauro Says:

    The talk was useful, but I have a hard time understanding if I can’t see code. I would really appreciate it if you could provide code samples.

    Thanks,

    Tony

Leave a Reply