From: <one...@us...> - 2002-10-31 15:10:27
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate In directory usw-pr-cvs1:/tmp/cvs-serv8698/cirrus/hibernate Modified Files: Hibernate.java Log Message: cirrus/hibernate/proxy/LazyInitializer.java Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/Hibernate.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** Hibernate.java 30 Oct 2002 15:42:31 -0000 1.60 --- Hibernate.java 31 Oct 2002 15:09:49 -0000 1.61 *************** *** 2,9 **** --- 2,13 ---- package cirrus.hibernate; + import cirrus.hibernate.proxy.HibernateProxy; + import cirrus.hibernate.proxy.HibernateProxyHelper; import cirrus.hibernate.type.*; import java.io.Serializable; + import java.sql.SQLException; import cirrus.hibernate.cfg.Configuration; + import cirrus.hibernate.collections.PersistentCollection; import cirrus.hibernate.impl.DatastoreImpl; import cirrus.hibernate.impl.SessionFactoryObjectFactory; *************** *** 161,164 **** --- 165,186 ---- configured = true; } + } + } + + /** + * Force initialization of a proxy or persistent collection. + * @param proxy a persistable object, proxy, persistent collection or <tt>null</tt> + * @throws HibernateException if we can't initialize the proxy at this time, eg. the <tt>Session</tt> was closed + * @throws SQLException + */ + public static void initialize(Object proxy) throws HibernateException, SQLException { + if (proxy==null) { + return; + } + else if ( proxy instanceof HibernateProxy ) { + HibernateProxyHelper.getLazyInitializer( (HibernateProxy) proxy ).initialize(); + } + else if ( proxy instanceof PersistentCollection ) { + ( (PersistentCollection) proxy ).forceLoad(); } } |