常言笑的家

          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)

          隨筆分類

          隨筆檔案

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 延津县| 会昌县| 余姚市| 南岸区| 中江县| 凤台县| 北宁市| 玉龙| 永康市| 安泽县| 栖霞市| 浑源县| 伊春市| 濮阳市| 喜德县| 从江县| 墨脱县| 马龙县| 册亨县| 金堂县| 拉孜县| 长沙县| 汤阴县| 五常市| 时尚| 平利县| 田东县| 克什克腾旗| 洪雅县| 三明市| 时尚| 中方县| 沙河市| 望城县| 泾川县| 通化市| 南昌市| 南漳县| 海南省| 东乡族自治县| 政和县|