Dr. Dobb's has a great article titled Coarse-Grained Unit Testing: Using OpenEJB and DBUnit to write repeatable unit tests for Java componentswhich shows how to combine OpenEJB with DBUnit to get a very effective testing setup. The article is complete with an example based on the fictitious Blue Star Galactic spaceship company. All source code is available to download.