| 
					
						 Is there any way to speedup the initialization of a SessionFactory. I have a standalone application that uses the following initialization code:
 
 Configuration cfg = new Configuration().configure("/hibernate.cfg.xml");
 SessionFactory _sessionFactory = cfg.buildSessionFactory();
 
 Works fine. The only problem is that when running and re-running my app in a debugger, it is time consuming to initialize the Configuration and SessionFactory. I wrote a standalone initializer application that tries to create the SessionFactory, then serialize it to a file so that the main application can simply de-serialize it and initialize faster. When I test this standalone initializer app by doing the following:
 
 1. Create a SessionFactory
 2. Serialize it to a file.
 3. Deserialize it from the file.
 4. Create a Hibernate session.
 
 ...it seems to work. The SessionFactory is created, serialized to the file, re-read and deserialized, and then Hibernate creates the Session.
 
 But when I try to deserialize the SessionFactory from my main application (run as a new Java process from the application that wrote the serialized SessionFactory to the file) I get the following exception:
 
 InvalidObjectException - "Could not find a SessionFactory named: null"
 
 ...and the following is written to the console:
 
 21:44:46,170  WARN SessionFactoryObjectFactory:148 - Not found: ff808081f86c369800f86c36ab5c0000
 21:44:46,179  WARN SessionFactoryObjectFactory:138 - Not found: null
 
 Does anyone know why this happens, and whether this approach can work. If not, I would appreciate any other suggestions as to how to speed up SessionFactory initialization. 
 
 Thank you,
 
 Rick Horowitz 
					
  
						
					 |