* @throws LazyInitializationException if we cannot initialize
*/
protected final void initialize(boolean writing) {
if ( !initialized ) {
if ( initializing ) {
throw new LazyInitializationException( "illegal access to loading collection" );
}
else if ( specjLazyLoad ) {
specialSpecjInitialization( writing );
}
else if ( session == null ) {
throw new LazyInitializationException( "could not initialize proxy - no Session" );
}
else if ( !session.isOpen() ) {
throw new LazyInitializationException( "could not initialize proxy - the owning Session was closed" );
}
else if ( !session.isConnected() ) {
throw new LazyInitializationException( "could not initialize proxy - the owning Session is disconnected" );
}
else {
throwLazyInitializationExceptionIfNotConnected();
session.initializeCollection( this, writing );
}