Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.LazyInitializationException: illegal access to loading collection
  at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1377)
  at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:828)
  at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:781)
  at jpa.JpaQuestion.main(JpaQuestion.java:23)
Caused by: org.hibernate.LazyInitializationException: illegal access to loading collection
  at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:377)
  at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:113)
  at org.hibernate.collection.internal.PersistentSet.hashCode(PersistentSet.java:428)
  at jpa.MyEntity.hashCode(MyEntity.java)
  at java.util.HashMap.put(HashMap.java:372)
  at java.util.HashSet.add(HashSet.java:200)
  at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
  at org.hibernate.collection.internal.PersistentSet.endRead(PersistentSet.java:346)
  at org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:243)
  at org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:233)
  at org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:210)
  at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:1021)
  at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1009)
  at org.hibernate.loader.Loader.doQuery(Loader.java:877)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:292)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:262)
  at org.hibernate.loader.Loader.loadEntity(Loader.java:1976)
  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:82)
  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:72)
  at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3719)
  at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:458)
  at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:427)
  at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:204)
  at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:260)
  at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:148)
  at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1079)
  at org.hibernate.internal.SessionImpl.access$2200(SessionImpl.java:172)
  at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2425)
  at org.hibernate.internal.SessionImpl.get(SessionImpl.java:975)
  at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:807)
  ... 2 more
Java Result: 1