We have had a long standing "inconvenience" with hibernate and its startup time.
We have 355 persistent classes (using a class per table approach on a legacy database schema). No, we can't change the schema unfortunately.
Some of the tables are large (150+ columns) with upwards of 30 FKs.
The startup time (To create and initialize the factory) is 20 Seconds on a P4 2.8Ghz machine. Some of the other machines in our development group take substantially longer (1 minute).
We have been able to reduce our startup time by roughly half by:
1) Moving all mapping to a singe XML file. Surprisingly, this improved startup by 25%.
2) Moving to the latest 3.2 release (Another 25%) Thanks!
We would really see great benefit from dynamically loading the configuration as it is needed, as we run our unit tests on each machine...many times a day.
We have played with serializing the XML configuration and it gives us no benefit in startup times.
We found this plugin which does exactly what we want but it is for the 2.x release of hibernate. (Thanks Peter!)
http://sourceforge.net/projects/hbn-dyn-mod/
I have hacked that plug-in in an attempt to move it to 3.x but I am certain my "patch" is not correct and probably doing something wrong. I have it compiling and my in my crude profiling I have found startup to be yet another 25% faster. I would really like to
a) Have someone that is familar with the hibernate source to contribute a 3.x version of this module. (I am willing to contribute my attempt at this) and normally I would do this myself, but I have tight deadlines.
b) Possibly have this code integrated with the hibernate distribution as an "option"
Thanks.
Tyler Van Gorder
tkv@landacorp.com