spring中对一些常见的问题有包装了

解决方案 »

  1.   


    建议是不要用hibernate,直接ibatis挺好的
      

  2.   

    写的倒是不错,用HIBERNATE 也只是用它的工厂,ORM 其余的我就没有看出HEBERNATE 的好处。
      

  3.   

    hibernate对一些表比较少的项目使用,
    spring主要部分就是依赖注入方面
    struts用的时候没感觉有什么
      

  4.   

    你既然用了spring,那为什么不用spring来整合hibernate呢?
    Spring API下的包
    org.springframework.orm.hibernate.support 
    Class HibernateDaoSupportorg.springframework.orm.hibernate 
    Class HibernateTemplatespring声明式管理事物,举个例子:
        <bean id="baseTransactionProxy"  
             class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"  abstract="true">  
             <property name="transactionManager" ref="transactionManager" />  
             <property name="transactionAttributes">  
                 <props>  
                     <prop key="add*">PROPAGATION_REQUIRED</prop>  
                     <prop key="update*">PROPAGATION_REQUIRED</prop>  
                     <prop key="modify*">PROPAGATION_REQUIRED</prop>  
                     <prop key="sel*">PROPAGATION_REQUIRED,readOnly</prop>  
                     <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>  
                     <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>  
                 </props>  
             </property>  
         </bean>    <bean id="studentService"  
             class="com.huanglq.service.StudentServiceImpl">  
             <property name="studentDao" ref="studentDao" />  
         </bean> 
     <!-- 在DAO级别的代理事务 -->  
         <bean id="studentDaoTransactionProxy"  
             parent="baseTransactionProxy">  
             <property name="target" ref="studentDao" />  
         </bean>