I have an entity which has a Map set to load eagerly. When trying to access
the map in a method annotated as PostLoad, I am getting a
LazyInitializationException ("illegal access to loading collection") from
AbstractPersistentCollection.java:341
| /**
| * Initialize the collection, if possible, wrapping any exceptions
| * in a runtime exception
| * @param writing currently obsolete
| * @throws LazyInitializationException if we cannot initialize
| */
| protected final void initialize(boolean writing) {
| if (!initialized) {
| if (initializing) {
| throw new LazyInitializationException("illegal
access to loading collection");
| }
| throwLazyInitializationExceptionIfNotConnected();
| session.initializeCollection(this, writing);
| }
| }
|
Correct me if I am wrong, but I think a PostLoad method should not be fired
until eagerly loaded properties are finished.
In other words, listeners.onPostLoad(postLoadEvent) from
TwoPhaseLoad.initializeEntity shouldn't be invoked until the "initializing"
field in each of the entity's eagerly loaded AbstractPersistentCollection
objects is set to false.
Any thoughts on whether this should be considered a bug?
How about any ideas for a workaround?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977408#3977408
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977408
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user