Hibernate4.X could not initialize proxy - no Session

could not initialize proxy - no Session

 

在web.xml中添加如下代码:

<filter>
	<filter-name>openSessionInViewFilter</filter-name>
	<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
	<init-param>
		<param-name>singleSession</param-name>
		<param-value>true</param-value>
	</init-param>
	<init-param>
		<param-name>sessionFactoryBeanName</param-name>
		<param-value>sessionFactory</param-value>
	</init-param>
</filter>

 

 

 

在hibernate.cfg.xml中添加如下代码:

<property name="hibernate.enable_lazy_load_no_trans">true</property>

 

你可能感兴趣的:(Hibernate,not init proxy,no Session)