Should I be using DBUnit?
Here's a question for you: Should I be using DBUnit in AppFuse and struts-resume? I've heard of it before, but have never used it. It sounds good:
The Dbunit database testing framework is a JUnit extension which sets up your database in a known state before executing your tests. This framework uses xml datasets (collection of data tables) and performs database operations before and after each test. The Dbunit framework supports both the clean insert and the refresh strategies.
Actually, know that I think of it, of course I should be! Currently, I use an Ant Sql task to create my database, and then Hibernate's SchemaExport
class to create the tables. I have no way to automagically enter data into the database. I suppose I could use another sql task in my build file, but it sounds like this job is more suited for DBUnit. I don't want to give up Hibernate's table generation as it's smart and adds new columns when I add new columns to my VO. Hopefully these two can work together nicely.
I also found this Best Practices guide on using Hibernate. The first line about using fine-grained objects has motivated me to refactor my User class.
Write fine-grained classes and map them using <component> or <component-element>. Use an Address class to encapsulate street, suburb, state, postcode. This encourages code reuse and simplifies refactoring.