-->
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.  [ 4 posts ] 
Author Message
 Post subject: Putting the SessionFactory in my application: good idea?
PostPosted: Mon Feb 16, 2004 4:06 pm 
Newbie

Joined: Mon Feb 16, 2004 3:56 pm
Posts: 2
When setting up my first test Hibernate/Tomcat application, I've noticed that the servlet takes a measurable amount of time (1.5 sec) to read my mapping files and configure itself.

I'm thinking I'll put my SessionFactory in the application scope and handle its initalization in my servlet's init() method; is this a good idea or is it a trap?

Thanks in advance... I'm thrilled at the amount of work Hibernate will be able to save me here.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 4:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Putting the SessionFactory in the application scope is perfectly fine. :)


Top
 Profile  
 
 Post subject: Re: Putting the SessionFactory in my application: good idea?
PostPosted: Mon Feb 16, 2004 4:10 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
njvack wrote:
I'm thinking I'll put my SessionFactory in the application scope and handle its initalization in my servlet's init() method; is this a good idea or is it a trap?

It's OK, people put it either in singleton, JNDI, etc... It's done for that.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 5:38 pm 
Newbie

Joined: Mon Feb 16, 2004 3:56 pm
Posts: 2
Excellent... I've tried it and now my skeletal little app is really fast :)

Thanks a million!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.