常言笑的家

          Spring, Hibernate, Struts, Ajax, RoR

          SpringMvc+Spring+Hibernate的問題總結(jié)

          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方法調(diào)用的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 框架后,必須在代理中設(shè)置 <property name="proxyTargetClass"  value="true"/>,否則就會出錯。

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

          My Links

          Blog Stats

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 阿瓦提县| 稷山县| 定结县| 平阴县| 县级市| 美姑县| 灵丘县| 东宁县| 来凤县| 南木林县| 建昌县| 利辛县| 六枝特区| 车致| 丰县| 方正县| 湛江市| 武夷山市| 舞钢市| 栾川县| 寿宁县| 综艺| 乌兰察布市| 嘉兴市| 张家川| 六盘水市| 南丹县| 固阳县| 冕宁县| 灌南县| 西昌市| 新巴尔虎右旗| 林口县| 英吉沙县| 闸北区| 广汉市| 裕民县| 卢湾区| 阜南县| 沁阳市| 广宁县|