Hi,
Check out DbUnit. It's rather cool, and quite easy. It can load your test data, clean out the db, etc. and it has a well thought-out usage model that I find very useful.
Cheers,
Bryan
squirreldev wrote:
Hibernate version:
3.2.0
Mapping documents:
Annotations only
Can someone suggest a strategy for populating reference data in unit tests where hibernate is used to generate the ddl? We use an in-memory database for our JUnit tests and we have an Entity which is read-only for which we need to have rows inserted into the table that Hibernate generates for us. Is there some API for doing this directly, or perhaps some interface we could implement to provide this custom data? I looked at the AbstractAuxiliaryDatabaseObject, but it appears to be intended to customize the DDL only, not to run arbitrary insert statements after all DDL has been executed. We would like to avoid introducing a database server requirement where scripts are executed (by Ant for example) prior to running JUnit tests.
Rob