These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Any way to speedup SessionFactory creation
PostPosted: Fri Oct 24, 2003 12:56 am 
Beginner
Beginner

Joined: Wed Oct 15, 2003 1:31 pm
Posts: 25
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.