Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/proxy
In directory usw-pr-cvs1:/tmp/cvs-serv9429/cirrus/hibernate/proxy
Modified Files:
LazyInitializer.java
Log Message:
Hibernate.initialize()
Index: LazyInitializer.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/proxy/LazyInitializer.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** LazyInitializer.java 29 Oct 2002 16:09:05 -0000 1.8
--- LazyInitializer.java 31 Oct 2002 15:10:57 -0000 1.9
***************
*** 64,87 ****
overridesEquals = ReflectHelper.overridesEquals(persistentClass);
}
!
! private void initialize() throws HibernateException, SQLException {
if (target==null) {
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"
! );
}
! try {
target = session.immediateLoad(persistentClass, id);
}
! catch (Exception e) {
! LogFactory.getLog(LazyInitializer.class).error("Exception initializing proxy", e);
! throw new LazyInitializationException(e);
! }
}
}
--- 64,89 ----
overridesEquals = ReflectHelper.overridesEquals(persistentClass);
}
!
! public void initialize() throws HibernateException, SQLException {
if (target==null) {
if ( session==null ) {
! throw new HibernateException("Could not initialize proxy - no Session");
}
else if ( !session.isOpen() ) {
! throw new HibernateException("Could not initialize proxy - the owning Session was closed");
}
! else {
target = session.immediateLoad(persistentClass, id);
}
! }
! }
!
! private void initializeWrapExceptions() {
! try {
! initialize();
! }
! catch (Exception e) {
! LogFactory.getLog(LazyInitializer.class).error("Exception initializing proxy", e);
! throw new LazyInitializationException(e);
}
}
***************
*** 162,166 ****
*/
public final Object getImplementation() throws HibernateException, SQLException {
! initialize();
return target;
}
--- 164,168 ----
*/
public final Object getImplementation() throws HibernateException, SQLException {
! initializeWrapExceptions();
return target;
}
|