常言笑的家

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 常言笑 阅读(1545) 评论(0)  编辑  收藏 所属分类: JAVA/J2EE


只有注册用户登录后才能发表评论。


网站导航:
 

My Links

Blog Stats

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜