进行懒加载处理后增加数据出现的问题:Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition。
Web.xml配置如下:
<filter>? 
??? <filter-name>hibernateFilter</filter-name>? 
??? <filter-class>? 
??????? org.springframework.orm.hibernate3.support.OpenSessionInViewFilter? 
??? </filter-class>? 
???? <init-param>? 
??????? <param-name>singleSession</param-name>? 
??????? <param-value>false</param-value>? 
??? </init-param>? 
</filter>? 
<filter-mapping>? 
??? <filter-name>hibernateFilter</filter-name>? 
??? <url-pattern>/*</url-pattern>? 
</filter-mapping>? 
?
出现上面的情况是因为之前Web.xml中没有这个
 <init-param>? 
??????? <param-name>singleSession</param-name>? 
??????? <param-value>false</param-value>? 
?</init-param>
?
?
或者是把false设置为true:
<init-param>? 
??????? <param-name>singleSession</param-name>? 
??????? <param-value>true</param-value>? 
?</init-param>