← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1914: Hibernate 3.5 deprecation fixes

 

------------------------------------------------------------
revno: 1914
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-05-27 12:18:46 +0200
message:
  Hibernate 3.5 deprecation fixes
modified:
  dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/cache/DefaultHibernateCacheManager.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.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/cache/DefaultHibernateCacheManager.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/cache/DefaultHibernateCacheManager.java	2010-05-17 22:14:26 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/cache/DefaultHibernateCacheManager.java	2010-05-27 10:18:46 +0000
@@ -27,10 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Map;
-
 import org.hibernate.SessionFactory;
-import org.hibernate.metadata.ClassMetadata;
 import org.hibernate.stat.Statistics;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -54,33 +51,21 @@
     // HibernateCacheManager implementation
     // -------------------------------------------------------------------------
 
-    @SuppressWarnings( "unchecked" )
     public void clearObjectCache()
     {
-        Map<String, ClassMetadata> classMetaData = sessionFactory.getAllClassMetadata();
-        
-        for ( String entityName : classMetaData.keySet() )
-        {
-            sessionFactory.evictEntity( entityName );
-        }
-
-        Map<String, ClassMetadata> collectionMetaData = sessionFactory.getAllCollectionMetadata();
-        
-        for ( String roleName : collectionMetaData.keySet() )
-        {
-            sessionFactory.evictCollection( roleName );
-        }
-    }
+        sessionFactory.getCache().evictEntityRegions();
+        sessionFactory.getCache().evictCollectionRegions();
+     }
     
     public void clearQueryCache()
     {
-        sessionFactory.evictQueries();
+        sessionFactory.getCache().evictDefaultQueryRegion();
+        sessionFactory.getCache().evictQueryRegions();
     }
     
     public void clearCache()
     {
-        clearObjectCache();
-        
+        clearObjectCache();        
         clearQueryCache();
     }
     

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java	2010-05-17 22:14:26 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java	2010-05-27 10:18:46 +0000
@@ -144,7 +144,7 @@
                
         cacheManager.clearCache();
         
-        log.debug( "Cleared Hiberate cache" );
+        log.debug( "Cleared Hibernate cache" );
     }
     
     public void clearSession()