[
https://jira.jboss.org/jira/browse/JBAS-5474?page=com.atlassian.jira.plug...
]
Tom van den Berge commented on JBAS-5474:
-----------------------------------------
I'm having exactly the same problem. I would say it's a Hibernate bug.
However, the JPA spec says
"The PostLoad method is invoked before a query result is returned or accessed or
before an association is traversed."
I'm not sure if the last part could mean that associated sets are not yet initialized,
or ready to be used, as that seems to be the case.
@Stefan: Could you please submit a test case?
@Emmanuel: Could you give some explanation (or point to it) on how to write a test case as
you would like to see it?
@PostLoad -> LazyInitializationException: illegal access to
loading collection ond a @OneToMany with FetchType.EAGER
--------------------------------------------------------------------------------------------------------------------
Key: JBAS-5474
URL:
https://jira.jboss.org/jira/browse/JBAS-5474
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EJB3
Affects Versions: JBossAS-4.2.2.GA
Environment: Win XP SP2, Java 1.5.0_15-b04
Reporter: Stefan Lindner
Assignee: Emmanuel Bernard
I have a bean with a @OneToMany relation mapping like
private List<TherapieeinheitBean> therapieeinheiten;
@OneToMany(
cascade = {CascadeType.REFRESH},
fetch = FetchType.EAGER,
mappedBy="therapiekatalog"
)
with FetchType.EAGER and a simnple @PostLoad like
@PostLoad
public void postLoad() {
System.out.println("!!!!!!!!!! postLoad !!!!!!!!!!");
System.out.print("size: " + therapieeinheiten.size());
}
When an entity of this bean is loaded JBoss trows
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)
at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
at
de.visiodesk.therapiekatalog.TherapiekatalogBean.postLoad(TherapiekatalogBean.java:170)
.
.
.
and prints the messages
WARN [LoadContexts] fail-safe cleanup (collections) :
org.hibernate.engine.loading.CollectionLoadContext@2c8ce9<rs=Ingres-ResultSet[18523]>
WARN [CollectionLoadContext] On CollectionLoadContext#cleanup,
localLoadingCollectionKeys contained [206] entries
afterwards. The PostLoad method should be called after the data was completely loaded. Is
there a workaround for this Problem? I found some other ressources on the net where peole
had the same problem, but I saw no resolution, no hint, no workaround.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira