=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2014-10-15 18:59:11 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2014-10-23 05:40:21 +0000 @@ -28,7 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import org.hisp.dhis.common.IdentifiableProperty; import org.hisp.dhis.common.NameableObject.NameableProperty; import java.util.Collection; @@ -122,6 +121,8 @@ int getCountLikeShortName( Class clazz, String shortName ); + void refresh( Object object ); + // ------------------------------------------------------------------------- // NO ACL // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2014-10-15 18:59:11 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2014-10-23 05:40:21 +0000 @@ -30,7 +30,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.common.IdentifiableProperty; +import org.hibernate.SessionFactory; import org.hisp.dhis.common.NameableObject.NameableProperty; import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.springframework.beans.factory.annotation.Autowired; @@ -61,6 +61,9 @@ @Autowired private Set> nameableObjectStores; + @Autowired + private SessionFactory sessionFactory; + private Map, GenericIdentifiableObjectStore> identifiableObjectStoreMap; private Map, GenericNameableObjectStore> nameableObjectStoreMap; @@ -683,6 +686,12 @@ } @Override + public void refresh( Object object ) + { + sessionFactory.getCurrentSession().refresh( object ); + } + + @Override @SuppressWarnings( "unchecked" ) public T getNoAcl( Class clazz, String uid ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2014-10-22 07:40:37 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2014-10-23 05:40:21 +0000 @@ -31,10 +31,7 @@ import com.google.common.base.Enums; import com.google.common.base.Optional; import com.google.common.collect.Lists; -import org.hibernate.LockOptions; -import org.hibernate.SessionFactory; import org.hisp.dhis.acl.AclService; -import org.hisp.dhis.cache.HibernateCacheManager; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.DxfNamespaces; import org.hisp.dhis.common.IdentifiableObject; @@ -127,9 +124,6 @@ @Autowired protected ContextService contextService; - @Autowired - private SessionFactory sessionFactory; - //-------------------------------------------------------------------------- // GET //-------------------------------------------------------------------------- @@ -584,7 +578,7 @@ } manager.update( objects.get( 0 ) ); - sessionFactory.getCurrentSession().refresh( candidate ); + manager.refresh( candidate ); } @RequestMapping( value = "/{uid}/{property}/{itemId}", method = RequestMethod.DELETE ) @@ -653,7 +647,7 @@ } manager.update( objects.get( 0 ) ); - sessionFactory.getCurrentSession().refresh( candidate ); + manager.refresh( candidate ); } //--------------------------------------------------------------------------