May 29th, 2006, 05:34 AM
Very slow running a hibernate unit test
We have a Hibernate data access project with more than 145 hbm mappings files. The problem is when we run a single unit test for a hibernate dao class, it takes too long. It seems that hibernate validates all the mappings before executing the test. Is there a way to disable those schema validation?
We are using cruisecontrol for continious integration but the build always fails because it takes too much time to execute all the unit test because of the schema validation being performed for each single unit test.
We are using hibernate 3.0.5. Our hibernate implementation dao extend org.springframework.orm.hibernate3.support.Hiberna teDaoSupport. Our unit tests for the dao's extend a custom class - which load all the needed Spring application context xml files - which extend org.springframework.test.AbstractDependencyInjecti onSpringContextTests.
The following parameter hibernate.hbm2ddl.auto is set to 'update'.
Any idea about disabling hibernate schema validation?
- edit -
I just changed the value of hibernate.hbm2ddl.auto from 'update' to 'validate'.
Now the schema validation are not performed anymore. The POJO's instances are created by spring and the HbmBinder verifies that the classes are found. Which reduce the time of a single unit test run to 20 seconds. Could not be faster?
Last edited by skredii; May 29th, 2006 at 06:12 AM.