StevenBot-Saltsam

眼睛能装下世界,为何却装不下眼泪? 一只风筝一辈子只为一根线冒险。 那不是一场游戏,为何总有一根线牵着心怀,隐隐作疼? 那不是一段邂逅,为何飘在桥上的影子,总缠进梦乡? 那不是一个梦境,为何你的温柔私语,总是不经意的响起?

导航

<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

统计

常用链接

留言簿

随笔分类

随笔档案

文章分类

文章档案

datas link

OSChinal Sources codes Library

搜索

最新评论

阅读排行榜

评论排行榜

OpenSessionInViewFilter 配置解决延迟加载

一、手动加载 如:
Hibernate.initialize(obj.getUser());//加载用户对象 



二、使用OpenSessionInViewFilter 配置解决延迟加载 如:
<!--OpenSessionInViewFilter 解决延迟加载问题 --> 
<filter> 
<filter-name>OpenSessionInViewFilter</filter-name> 
<filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter                </filter-class> 
<!-- singleSession默认为true,若设为false则等于没用OpenSessionInView --> 
<init-param> 
<param-name>singleSession</param-name> 
<param-value>true</param-value> 
</init-param> 
</filter> 
<filter-mapping> 
<filter-name>OpenSessionInViewFilter</filter-name> 
<url-pattern>/*</url-pattern> 
</filter-mapping> 

posted on 2011-11-09 10:16 Steven_bot 阅读(281) 评论(0)  编辑  收藏 所属分类: spring


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


网站导航: