← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5908: Fixed bug <927113> Exception occurs after delete data element group.

 

------------------------------------------------------------
revno: 5908
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-10 15:25:18 +0700
message:
  Fixed bug <927113> Exception occurs after delete data element group.
modified:
  dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java	2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java	2012-02-10 08:25:18 +0000
@@ -27,6 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+import java.util.List;
+
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.SQLQuery;
@@ -35,13 +38,12 @@
 import org.hibernate.criterion.Order;
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.cache.HibernateCacheManager;
 import org.hisp.dhis.common.GenericNameableObjectStore;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Required;
 import org.springframework.jdbc.core.JdbcTemplate;
 
-import java.util.Collection;
-import java.util.List;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -64,6 +66,9 @@
         this.jdbcTemplate = jdbcTemplate;
     }
 
+    @Autowired
+    protected HibernateCacheManager cacheManager;
+
     private Class<T> clazz;
 
     /**
@@ -107,7 +112,7 @@
 
     /**
      * Creates a Query.
-     *
+     * 
      * @param hql the hql query.
      * @return a Query instance.
      */
@@ -118,7 +123,7 @@
 
     /**
      * Creates a SqlQuery.
-     *
+     * 
      * @param sql the sql query.
      * @return a SqlQuery instance.
      */
@@ -131,7 +136,7 @@
 
     /**
      * Creates a Critera for the implementation Class type.
-     *
+     * 
      * @return a Criteria instance.
      */
     protected final Criteria getCriteria()
@@ -147,7 +152,7 @@
     /**
      * Creates a Criteria for the implementation Class type restricted by the
      * given Criterions.
-     *
+     * 
      * @param expressions the Criterions for the Criteria.
      * @return a Criteria instance.
      */
@@ -165,7 +170,7 @@
 
     /**
      * Retrieves an object based on the given Criterions.
-     *
+     * 
      * @param expressions the Criterions for the Criteria.
      * @return an object of the implementation Class type.
      */
@@ -177,7 +182,7 @@
 
     /**
      * Retrieves a List based on the given Criterions.
-     *
+     * 
      * @param expressions the Criterions for the Criteria.
      * @return a List with objects of the implementation Class type.
      */
@@ -271,6 +276,7 @@
     public final void delete( T object )
     {
         sessionFactory.getCurrentSession().delete( object );
+        cacheManager.clearCache();
     }
 
     @Override