java中的异常could not initialize proxy - no Session

运行时报如下异常:

org.hibernate.LazyInitializationException: could not initialize proxy - no Session
	at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132)
	at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
	at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)

解决方法是:

找到你正在操作的实体类的映射文件(*.hbm.xml),将 标签中的Lazy=“proxy”修改成Lazy=“false”

你可能感兴趣的:(java)