-->
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.  [ 2 posts ] 
Author Message
 Post subject: hibernate best practice (to get fast results )
PostPosted: Tue Aug 16, 2011 12:13 pm 
Newbie

Joined: Wed May 18, 2011 3:25 am
Posts: 2
I was just wondering what is the best way to use hibernate & spring in our Application, like i have implemented hibernate in my web application. Every thing is working fine but the thing is i have a list of classes which i have in my applicationcontext.xml class Now when i need to use any of those classes I make object of this applicationContext.xml class as below

ApplicationContext ctx = new ClassPathXmlApplicationContext(
"applicationContext.xml");
MySQLRdbSpringHelper rdbHelper = (MySQLRdbSpringHelper) ctx.getBean("ManagerJobs");
but by this method ,the program invokes all of the classes in application context.xml(below) in the List which uses more memory, isn't there a way to invoke the only class which we need one at a time..?

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.zrsol.joblistings.shared.Employer</value>
<value>com.zrsol.joblistings.shared.StatesProvinces</value>
<value>com.zrsol.joblistings.shared.EmployerJobs</value>
<value>com.zrsol.joblistings.shared.CandidateResumeInfo</value>
<value>com.zrsol.joblistings.shared.CandidateSkills</value>
<value>com.zrsol.joblistings.shared.CandidateInfo</value>
<value>com.zrsol.joblistings.shared.SelectedResumes</value>
<value>com.zrsol.joblistings.shared.SecretQuestionsBean</value>
<value>com.zrsol.joblistings.shared.Categories</value>
<value>com.zrsol.joblistings.shared.EducationLevel</value>
<value>com.zrsol.joblistings.shared.Salary</value>
<value>com.zrsol.joblistings.shared.JobLevel</value>
<value>com.zrsol.joblistings.shared.EmployerCvSearches</value>
</list>
</property>
</bean>
<bean id ="ManagerJobs" class= "jobsite.persistence.MySQLRdbSpringHelper">
<property name="sessionFactory" ref="sessionFactory" />
</bean>



Thanks
Junaid


Top
 Profile  
 
 Post subject: Re: hibernate best practice (to get fast results )
PostPosted: Wed Aug 17, 2011 8:04 am 
Newbie

Joined: Mon Aug 16, 2010 12:32 pm
Posts: 12
No all the classes will be initialized but I don't see wher you would get a memory problem from this, it's not like hibernate will load the whole DB into memory


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