-->
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.  [ 3 posts ] 
Author Message
 Post subject: SessionFactory init takes too long
PostPosted: Tue Jan 09, 2007 10:14 am 
Newbie

Joined: Tue Jan 09, 2007 9:53 am
Posts: 2
Hello everybody,

I was wondering if there was a way to optimize the initialization of the session factory. My database is quite large (maybe 300 tables) and it takes an average 2 minutes to complete.

Could I serialize the session factory? Should I upgrade to Hibernate 3? Is there some tuning to do in order to skip schema mapping validation? Any clues welcome.

Hibernate version: 2.1.8

Name and version of the database you are using: Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 1:09 pm 
Regular
Regular

Joined: Wed Dec 07, 2005 4:19 pm
Posts: 53
SessionFactory implements Serializable, so you should be able to save it - I was contemplating doing just that, but did not try it yet.

What discouraged me was the fact that I would have to watch not only for changes in all my mapping files, BUT also for any object implementation file changes - SessionFactory uses CGLIB to generate code from your persistent classes.
Hence, optimizing the load by serialization would not help me much during development, and in production, the startup time is less of an issue.

Your other options are:
- Use multiple session factories - each covering a different portion of your schema - if possible (granted, more things to worry about)

- Perform SessionFactory initialization in a background thread, so that (while SessionFactory intializes), you can build your UI and other 'stuff'.

For example, we have a separate SessionFactory (well, and sometimes database) for authentication - so while the user is coping with the login, we can happily initialize our BIG SessionFactory (using a lower-priority thread).

Don't forget to rate this posting!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 12:34 pm 
Newbie

Joined: Tue Sep 27, 2005 8:12 am
Posts: 12
Just wondering if you had any success in serializing session factory?

Thanks.


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

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.