常言笑的家

          Spring, Hibernate, Struts, Ajax, RoR

          SpringMvc+Spring+Hibernate的問題總結

          1、sessionFactory問題
          < bean  id ="sessionFactory"  class ="org.springwork.orm.hibernate3.LocalSessionFactoryBean" >
            
          < property  name ="dataSource" >
             
          < ref  bean ="DataSource"   />
            
          </ property >
            
          < property  name ="hibernateProperties" >
             
          < props >
              
          < prop  key ="hibernate.dialect" > ${hibernate.dialect} </ prop >
              
          < prop  key ="hibernate.show_sql" > ${hibernate.show_sql} </ prop >
              
          < prop  key ="hibernate.cache.use_query_cache" > ${hibernate.cache.use_query_cache} </ prop >
              
          < prop  key ="hibernate.cache.provider_class" > ${hibernate.cache.provider_class} </ prop >
             
          </ props >
            
          </ property >
            
          < property  name ="mappingDirectoryLocations" >
                      
          < list >
                          
          <value> classpath*:com/newtouch/cial/model/hbm/ </>
                      
          </ list >
                  
          </ property >
           
          </ bean >
           
                 在SpringMvc的 Controller類中set方法調用的session名稱為:sessionFactory,如果這里的名稱或者大小寫不一致,那么在xxxx-servlet.xml初始化Controller類時就會出錯。
           
          2、Spring2.0的代理問題
           
           1 < bean  id ="txProxyTemplate"  abstract ="true"  class ="org.springwork.transaction.interceptor.TransactionProxyFactoryBean" >
           2    < property  name ="transactionManager"  ref ="transactionManager"   />
           3    < property  name ="proxyTargetClass"   value ="true" />
           4    < property  name ="transactionAttributes" >
           5              < props >
           6                  < prop  key ="get*" > PROPAGATION_REQUIRED,readOnly </ prop >
           7                  < prop  key ="find*" > PROPAGATION_REQUIRED,readOnly </ prop >
           8                  < prop  key ="load*" > PROPAGATION_REQUIRED,readOnly </ prop >
           9                  < prop  key ="save*" > PROPAGATION_REQUIRED </ prop >
          10                  < prop  key ="update*" > PROPAGATION_REQUIRED </ prop >
          11                  < prop  key ="remove*" > PROPAGATION_REQUIRED </ prop >
          12              </ props >
          13          </ property >
          14   </ bean >
                 在Spring2.0后,特別是在使用了 SpringSide 框架后,必須在代理中設置 <property name="proxyTargetClass"  value="true"/>,否則就會出錯。

          posted on 2006-12-16 22:51 常言笑 閱讀(1559) 評論(0)  編輯  收藏 所屬分類: JAVA/J2EE

          My Links

          Blog Stats

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 罗甸县| 遵化市| 克东县| 城市| 清镇市| 龙口市| 乌拉特中旗| 石家庄市| 抚顺县| 招远市| 衢州市| 揭东县| 绥宁县| 遵义市| 丽江市| 乐业县| 龙川县| 利辛县| 方山县| 阿尔山市| 桦甸市| 屏边| 中宁县| 报价| 泸溪县| 郯城县| 疏勒县| 梁山县| 延长县| 淮阳县| 临泽县| 东港市| 罗山县| 平定县| 五常市| 新郑市| 夏津县| 青州市| 靖西县| 麻城市| 潜山县|