日期:2014-05-16  浏览次数:21001 次

Hibernate错误:org.hibernate.LazyInitializationException: illegal access to loading

?

org.hibernate.LazyInitializationException: illegal access to loading collection
? at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
? at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)


原因在于pojo里面的 ? public int hashCode() {... } 方法调用了set对象成员的hashCode()方法
如this.getSets().hashCode();
删除该方法的调用即可;调用非set对象成员的.hashCode()方法没有问题。

?

?