This exception in my opinion is not because of the mapping (which seems ok).
This exception in my opinion comes when working with more threads contemporanously on the same persistent objects (= with the same session / persistent context):
While one thread is initializing the collection (initializing == true) the other tries to access the same collection.
Code:
protected final void initialize(boolean writing) {
if (!initialized) {
if (initializing) {
throw new LazyInitializationException("illegal access to loading collection");
}
throwLazyInitializationExceptionIfNotConnected();
session.initializeCollection(this, writing);
}
}
Can it be that you are sharing a session between different threads ? (that should be avoided).