[Join-cvs] join1/src/main/org/figure8/join/core/persistence HibernateObjectDao.java, 1.2, 1.3 Objec
Brought to you by:
lbroudoux
|
From: Laurent B. <lbr...@us...> - 2008-02-03 22:40:57
|
Update of /cvsroot/join/join1/src/main/org/figure8/join/core/persistence In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1753/core/persistence Modified Files: HibernateObjectDao.java ObjectDao.java Log Message: Add initialieAssociation() method for feature allowing remote interaction with resources and their versions Index: HibernateObjectDao.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/core/persistence/HibernateObjectDao.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HibernateObjectDao.java 4 Jul 2006 19:39:14 -0000 1.2 --- HibernateObjectDao.java 3 Feb 2008 22:40:52 -0000 1.3 *************** *** 1,4 **** /** ! * Copyright 2005-2006 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the --- 1,4 ---- /** ! * Copyright 2005-2008 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the *************** *** 26,29 **** --- 26,30 ---- import net.sf.hibernate.Session; import net.sf.hibernate.LockMode; + import net.sf.hibernate.Hibernate; import net.sf.hibernate.ReplicationMode; import net.sf.hibernate.HibernateException; *************** *** 126,129 **** --- 127,162 ---- /** + * Force initialization of the given entity association from underlying datastore + * @param entityobject EntityObject whose association shoud be initialized + * @param proxy A proxy object representing entoty association (this may be a collection) + */ + public void initializeAssociation(EntityObject entityobject, Object proxy){ + try{ + // Execute proxy initialization after having reattached entity object. + getHibernateTemplate().lock(entityobject, LockMode.READ); + getHibernateTemplate().initialize(proxy); + } + catch (Exception e){ + log.error("Exception in initializeAssociation()!", e); + throw new InfrastructureException(e); + } + } + + /** + * Check if an object (EntityObject or association proxy) is initialized from datastore + * @param object The object to check initialization for + * @return true if object has been loaded from datastore, false otherwise + */ + public boolean isInitialized(Object object){ + try{ + return Hibernate.isInitialized(object); + } + catch (Exception e){ + log.error("Exception in isInitialized()!", e); + throw new InfrastructureException(e); + } + } + + /** * Persist the object state throughout the cluster. * @param obj The object to replicate Index: ObjectDao.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/core/persistence/ObjectDao.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ObjectDao.java 4 Jul 2006 19:39:14 -0000 1.2 --- ObjectDao.java 3 Feb 2008 22:40:52 -0000 1.3 *************** *** 1,4 **** /** ! * Copyright 2005-2006 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the --- 1,4 ---- /** ! * Copyright 2005-2008 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the *************** *** 54,57 **** --- 54,71 ---- /** + * Force initialization of the given entity association from underlying datastore + * @param entityobject EntityObject whose association shoud be initialized + * @param proxy A proxy object representing entoty association (this may be a collection) + */ + public abstract void initializeAssociation(EntityObject entityobject, Object proxy); + + /** + * Check if an object (EntityObject or association proxy) is initialized from datastore + * @param object The object to check initialization for + * @return true if object has been loaded from datastore, false otherwise + */ + public abstract boolean isInitialized(Object object); + + /** * Persist the object state throughout the cluster. * @param obj The object to replicate |