-->
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: Avoiding Loading Configuration twice
PostPosted: Tue Jul 26, 2005 7:26 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Our shop has two Hibernate utilities. Each one has a static initialization block that loads all the mapping data and creates a session factory. I am using both of the utilities, and want to avoid loading the config intormation twice. How to I check for this programmatically?


Top
 Profile  
 
 Post subject: Re: Avoiding Loading Configuration twice
PostPosted: Wed Jul 27, 2005 12:10 pm 
Newbie

Joined: Wed Jul 13, 2005 7:00 pm
Posts: 9
dennisbyrne wrote:
Our shop has two Hibernate utilities. Each one has a static initialization block that loads all the mapping data and creates a session factory. I am using both of the utilities, and want to avoid loading the config intormation twice. How to I check for this programmatically?


I can think of moving the static sessionfactory and its initialization into a singleton class. And in the two utility classes, just get the instance of singleton, get the sessionfactory and call the methods on it.

But i'm inquisitive as to why two Hibernate Utility classes are required in the first place. Can you tell this specific scenario where you are using two Hibernate Utility classes ? I couldn't think of any.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 12:31 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Your proposed solution is what I went with.

The second class was built for Hibernate 3.

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.