Hibernate报错org.hibernate.LazyInitializationException: illegal access to loading collection

Hibernate报错org.hibernate.LazyInitializationException: illegal access to loading collection
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()方法没有问题。

你可能感兴趣的:(Hibernate报错org.hibernate.LazyInitializationException: illegal access to loading collection)