67,513
社区成员
发帖
与我相关
我的任务
分享
<filter>
<description>
延长hibernate中session的生命周期
</description>
<filter-name>OpenSessionInView</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>flushMode</param-name>
<param-value>AUTO</param-value>
</init-param>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>OpenSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
public LjyPhototype getFreshPhotoType(LjyPhototype photoType){
LjyPhototype photoType2=new LjyPhototype();
if(photoType==null){
return null;
}
if(photoType!=null){
if(photoType.getId()!=null){
photoType2.setId(photoType.getId());
}
}
if(photoType.getLjyAdmin()!=null){
if(photoType.getLjyAdmin().getAdminId()!=null){
photoType2.setLjyAdmin(photoType.getLjyAdmin());
}
}
……
return photoType2;
}