0

I have a project with spring and hibernate in GWT, I am using below applicationcontext.xml, I was just looking for some best approach of making this file like all the annotated classes below i.e entity.user, entity.secretQuestion and many more , they all get called when my application runs even if i don't need them , which i guess makes my application quite slow, so is it possible that only the class which i am calling is getting load in applicationcontext.xml and if yes then would it be a better approach as well ?

                 <bean id="sessionFactory"
                class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 
              <property name="dataSource" ref="dataSource" /> 
              <property name="annotatedClasses"> 
              <list> 
              <value>com.cricsite.persistence.entity.User</value>
              <value>com.cricsite.persistence.entity.SecretQuestion</value>


                </list> 
                </property> 
                </bean>
               <bean id ="ManagerAdmin" class= "com.persistence.MySQLRdbHelper">
                <property name="sessionFactory" ref="sessionFactory" />
                </bean>

user1226162
  • 1,822
  • 7
  • 27
  • 41

1 Answers1

0

You might be looking for something called "lazy loading"

Please take a look at these threads;

Help needed with Spring/Hibernate Lazy-loading

What is lazy loading in Hibernate?

how does spring allow for lazy-loading?

Community
  • 1
  • 1
mhan
  • 375
  • 3
  • 11