0

我在 GWT 中有一个带有 spring 和 hibernate 的项目,我在 applicationcontext.xml 下面使用,我只是在寻找一些最好的方法来制作这个文件,就像下面的所有带注释的类一样,即 entity.user、entity.secretQuestion 等等,他们即使我不需要它们,当我的应用程序运行时都会调用它们,我想这会使我的应用程序很慢,所以有可能只有我正在调用的类在 applicationcontext.xml 中加载,如果是,那么它会也是一种更好的方法吗?

                 <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>

4

1 回答 1

0

您可能正在寻找一种叫做“延迟加载”的东西

请查看这些线程;

Spring/Hibernate 延迟加载需要帮助

Hibernate 中的延迟加载是什么?

spring 如何允许延迟加载?

于 2012-04-05T16:41:20.573 回答