【问题标题】:best approach for setting hibernate/spring project设置休眠/春季项目的最佳方法
【发布时间】:2012-04-05 16:35:32
【问题描述】:

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

【问题讨论】:

    标签: spring hibernate gwt


    【解决方案1】:

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

    请查看这些线程;

    Help needed with Spring/Hibernate Lazy-loading

    What is lazy loading in Hibernate?

    how does spring allow for lazy-loading?

    【讨论】:

      猜你喜欢
      • 2011-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-25
      相关资源
      最近更新 更多