roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r394696 [1/2] - in /incubator/roller/branches/roller-newbackend: ./ src/org/roller/business/hibernate/ src/org/roller/model/ src/org/roller/presentation/ src/org/roller/presentation/pings/ src/org/roller/presentation/planet/ src/org/roller/...
Date Mon, 17 Apr 2006 15:23:16 GMT
Author: agilliland
Date: Mon Apr 17 08:23:11 2006
New Revision: 394696

URL: http://svn.apache.org/viewcvs?rev=394696&view=rev
Log:
adding support for Roller.flush() method.
removing explicit transaction demarcation from XXXManager impls.
fixing up unit tests to make sure they call Roller.flush() when appropriate.


Modified:
    incubator/roller/branches/roller-newbackend/build.xml
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateAutoPingManagerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingTargetManagerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePropertiesManagerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateRollerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java
    incubator/roller/branches/roller-newbackend/src/org/roller/model/Roller.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/RollerContext.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/TurnoverReferersTask.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueTask.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/planet/PlanetConfigAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/planet/PlanetGroupsAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/planet/PlanetSubscriptionsAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/planet/RefreshEntriesTask.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/planet/SyncWebsitesTask.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/servlets/CommentServlet.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/servlets/TrackbackServlet.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/BasePingTargetsAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/CategoriesAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/CategoryDeleteAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/CategorySaveAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/CommentManagementAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/PingSetupAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/ReferersAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/ToggleLinkbackDisplayAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/weblog/actions/WeblogEntryFormAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/CreateWebsiteAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/MemberPermissionsAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/RollerPropertiesAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/ThemeEditorAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/UserAdminAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/UserNewAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/WeblogTemplateFormAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/WebsiteFormAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/YourProfileAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/website/actions/YourWebsitesAction.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/xmlrpc/BloggerAPIHandler.java
    incubator/roller/branches/roller-newbackend/src/org/roller/presentation/xmlrpc/MetaWeblogAPIHandler.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/TestUtils.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/CommentTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/FileManagerTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/PermissionTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/PingsTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/PlanetManagerTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/PropertiesTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/UserTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogCategoryTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogEntryTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogPageTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogTest.java

Modified: incubator/roller/branches/roller-newbackend/build.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/build.xml?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/build.xml (original)
+++ incubator/roller/branches/roller-newbackend/build.xml Mon Apr 17 08:23:11 2006
@@ -816,17 +816,18 @@
         <formatter type="xml"/>
         <batchtest toDir="${build.reports}/business/xml">
             <fileset dir="${build.tests}/WEB-INF/classes">
-               <include name="org/roller/business/UserTest.class"/> 
-	       <include name="org/roller/business/WeblogTest.class"/>
-	       <include name="org/roller/business/PermissionTest.class"/>
-	       <include name="org/roller/business/WeblogPageTest.class"/>
-	       <include name="org/roller/business/PingsTest.class"/>
-	       <include name="org/roller/business/PropertiesTest.class"/>
-	       <include name="org/roller/business/WeblogEntryTest.class"/>
-	       <include name="org/roller/business/WeblogCategoryTest.class"/>
-	       <include name="org/roller/business/FileManagerTest.class"/>
-	       <include name="org/roller/business/CommentTest.class"/>
-	       <include name="org/roller/business/PlanetManagerTest.class"/>
+		<!-- UserManager Tests -->
+		<include name="org/roller/business/UserTest.class"/> 
+	        <include name="org/roller/business/WeblogTest.class"/>
+	        <include name="org/roller/business/PermissionTest.class"/>
+	        <include name="org/roller/business/WeblogPageTest.class"/>
+	        <include name="org/roller/business/PingsTest.class"/>
+	        <include name="org/roller/business/PropertiesTest.class"/>
+	        <include name="org/roller/business/WeblogEntryTest.class"/>
+	        <include name="org/roller/business/WeblogCategoryTest.class"/>
+	        <include name="org/roller/business/CommentTest.class"/>
+		<include name="org/roller/business/FileManagerTest.class"/>
+	        <include name="org/roller/business/PlanetManagerTest.class"/>
             </fileset>
         </batchtest>
     </junit>

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateAutoPingManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateAutoPingManagerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateAutoPingManagerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateAutoPingManagerImpl.java Mon Apr 17 08:23:11 2006
@@ -58,21 +58,18 @@
     
     
     public void storeAutoPing(AutoPingData autoPing) throws RollerException {
-        strategy.storeAndCommit(autoPing);
+        strategy.store(autoPing);
     }
     
     
     public void removeAutoPing(AutoPingData autoPing)  throws RollerException {
         //TODO: first remove all related category restrictions (category restrictions are not yet implemented)
-        strategy.removeAndCommit(autoPing);
+        strategy.remove(autoPing);
     }
     
     
     public void removeAutoPing(PingTargetData pingTarget, WebsiteData website) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = strategy.getSession();
             Criteria criteria = session.createCriteria(AutoPingData.class);
             
@@ -92,29 +89,10 @@
     
     public void removeAutoPings(Collection autopings) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // just go through the list and remove each auto ping
-            Iterator pings = autopings.iterator();
-            while (pings.hasNext()) {
-                    this.strategy.remove((AutoPingData) pings.next());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (HibernateException ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(HibernateException he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        // just go through the list and remove each auto ping
+        Iterator pings = autopings.iterator();
+        while (pings.hasNext()) {
+            this.strategy.remove((AutoPingData) pings.next());
         }
     }
     
@@ -149,9 +127,6 @@
     
     public List getAutoPingsByWebsite(WebsiteData website) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(AutoPingData.class);
             // Currently category restrictions are not yet implemented, so we return all auto ping configs for the
@@ -166,9 +141,6 @@
     
     public List getAutoPingsByTarget(PingTargetData pingTarget) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(AutoPingData.class);
             // Currently category restrictions are not yet implemented, so we return all auto ping configs for the
@@ -183,9 +155,6 @@
     
     public List getApplicableAutoPings(WeblogEntryData changedWeblogEntry) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(AutoPingData.class);
             // Currently category restrictions are not yet implemented, so we return all auto ping configs for the

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePersistenceStrategy.java Mon Apr 17 08:23:11 2006
@@ -68,27 +68,50 @@
      * it will return the already open Session.
      */
     protected Session getSession() {
-        return sessionFactory.getCurrentSession();
+        
+        // get Hibernate Session and make sure we are in a transaction
+        // this will join existing Session/Transaction if they exist
+        Session session = sessionFactory.getCurrentSession();
+        session.beginTransaction();
+        
+        return session;
+    }
+    
+    
+    protected void flush() throws RollerException {
+        
+        Session session = getSession();
+        try {
+            session.getTransaction().commit();
+        } catch(Throwable t) {
+            // uh oh ... failed persisting, gotta release
+            release();
+        }
     }
     
     
     /**
-     * Release database session, rolls back any uncommitted changes.
+     * Release database session, rollback any uncommitted changes.
      */
-    protected void release() throws HibernateException {
-        
-        Session session = this.getSession();
+    protected void release() {
         
-        if(session != null) {
-            if(session.isOpen()) {
-                
-                log.debug("Closing open hibernate session");
+        try {
+            Session session = getSession();
+            
+            if(session != null && session.isOpen()) {
                 
-                // TODO BACKEND: should we do a rollback()?
-                //session.getTransaction().rollback();
+                log.debug("Closing Hibernate Session");
                 
-                session.close();
+                try {
+                    session.getTransaction().rollback();
+                } catch(Throwable t) {
+                    log.error("ERROR doing Hibernate rollback", t);
+                } finally {
+                    session.close();
+                }
             }
+        } catch(Throwable t) {
+            log.error("ERROR closing Hibernate Session", t);
         }
     }
 
@@ -102,9 +125,6 @@
             throw new RollerException("Cannot load objects when value is null");
         }
         
-        // begin transaction
-        getSession().beginTransaction();
-            
         return (PersistentObject) getSession().get(clazz, id);
     }
     
@@ -165,27 +185,7 @@
      * If the commit fails then we rollback and release the session.
      */
     protected void storeAndCommit(PersistentObject obj) throws RollerException {
-        
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.store(obj);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.store(obj);
     }
     
     
@@ -210,27 +210,7 @@
      * If the commit fails then we rollback and release the session.
      */
     protected void storeAndCommit(Collection objects) throws RollerException {
-        
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.store(objects);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.store(objects);
     }
     
     
@@ -245,9 +225,7 @@
         
         Session session = getSession();
         
-        // TODO BACKEND: it seems really inefficient to load and then delete.
         PersistentObject obj = (PersistentObject) session.load(clazz,id);
-        
         session.delete(obj);
     }
     
@@ -263,26 +241,7 @@
             throw new RollerException("Cannot remove object when values are null");
         }
         
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.remove(id, clazz);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.remove(id, clazz);
     }
     
     
@@ -307,27 +266,7 @@
      * If the commit fails then we rollback and release the session.
      */
     protected void removeAndCommit(Collection ids, Class clazz) throws RollerException {
-        
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.remove(ids, clazz);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.remove(ids, clazz);
     }
     
     
@@ -361,26 +300,7 @@
             throw new RollerException("Cannot remove null object");
         }
         
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.remove(obj);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.remove(obj);
     }
     
     
@@ -405,27 +325,7 @@
      * If the commit fails then we rollback and release the session.
      */
     protected void removeAndCommit(Collection objects) throws RollerException {
-        
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.remove(objects);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.remove(objects);
     }
     
     
@@ -435,27 +335,7 @@
      * If the commit fails then we rollback and release the session.
      */
     protected void storeAndCommit(HierarchicalPersistentObject obj) throws RollerException {
-        
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.store(obj);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.store(obj);
     }
     
     
@@ -575,26 +455,7 @@
             throw new RollerException("Cannot remove null object");
         }
         
-        try {
-            // begin transaction
-            getSession().beginTransaction();
-            
-            this.remove(obj);
-            
-            // commit changes
-            getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            release();
-            
-            throw new RollerException(ex);
-        }
+        this.remove(obj);
     }
     
     

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java Mon Apr 17 08:23:11 2006
@@ -51,13 +51,13 @@
     
     public void storeQueueEntry(PingQueueEntryData pingQueueEntry) throws RollerException {
         log.debug("Storing ping queue entry: " + pingQueueEntry);
-        strategy.storeAndCommit(pingQueueEntry);
+        strategy.store(pingQueueEntry);
     }
     
     
     public void removeQueueEntry(PingQueueEntryData pingQueueEntry) throws RollerException {
         log.debug("Removing ping queue entry: " + pingQueueEntry);
-        strategy.removeAndCommit(pingQueueEntry);
+        strategy.remove(pingQueueEntry);
     }
     
     
@@ -66,9 +66,6 @@
         try {
             log.debug("Removing all ping queue entries for ping target " + pingTarget);
             
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = strategy.getSession();
             Criteria criteria = session.createCriteria(PingQueueEntryData.class);
             criteria.add(Expression.eq("pingTarget", pingTarget));
@@ -85,9 +82,6 @@
         try {
             log.debug("Removing all ping queue entries for website " + website);
             
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingQueueEntryData.class);
             criteria.add(Expression.eq("website", website));
@@ -124,9 +118,6 @@
     
     public List getAllQueueEntries() throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingQueueEntryData.class);
             criteria.addOrder(Order.asc("entryTime"));
@@ -141,9 +132,6 @@
     // private helper to determine if an has already been queued for the same website and ping target.
     private boolean isAlreadyQueued(AutoPingData autoPing) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingQueueEntryData.class);
             criteria.add(Expression.eq("pingTarget", autoPing.getPingTarget()));
@@ -158,29 +146,10 @@
     // Private helper to remove a collection of queue entries
     private void removeEntries(Collection queueEntries) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // just go through the list and remove each auto ping
-            Iterator entries = queueEntries.iterator();
-            while (entries.hasNext()) {
-                    this.strategy.remove((PingQueueEntryData) entries.next());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (HibernateException ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(HibernateException he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        // just go through the list and remove each auto ping
+        Iterator entries = queueEntries.iterator();
+        while (entries.hasNext()) {
+            this.strategy.remove((PingQueueEntryData) entries.next());
         }
     }
     

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingTargetManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingTargetManagerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingTargetManagerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingTargetManagerImpl.java Mon Apr 17 08:23:11 2006
@@ -61,7 +61,7 @@
     
     
     public void storePingTarget(PingTargetData pingTarget) throws RollerException {
-        strategy.storeAndCommit(pingTarget);
+        strategy.store(pingTarget);
     }
     
     
@@ -72,30 +72,11 @@
     
     public void removePingTarget(String id) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            PingTargetData pingTarget = retrievePingTarget(id);
-            
-            // remove contents and then target
-            this.removePingTargetContents(pingTarget);
-            strategy.remove(pingTarget);
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
-        }
+        PingTargetData pingTarget = retrievePingTarget(id);
+        
+        // remove contents and then target
+        this.removePingTargetContents(pingTarget);
+        strategy.remove(pingTarget);
     }
     
     
@@ -138,9 +119,6 @@
     public void removeAllCustomPingTargets() throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = strategy.getSession();
             Criteria criteria = session.createCriteria(PingTargetData.class);
             criteria.add(Expression.isNotNull("website"));
@@ -155,32 +133,13 @@
     // Private helper to remove a collection of targets.
     private void removeTargets(Collection customTargets) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // just go through the list and remove each auto ping
-            Iterator targets = customTargets.iterator();
-            while (targets.hasNext()) {
-                    this.strategy.remove((PingTargetData) targets.next());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        // just go through the list and remove each auto ping
+        Iterator targets = customTargets.iterator();
+        while (targets.hasNext()) {
+            this.strategy.remove((PingTargetData) targets.next());
         }
     }
-    
+
     
     public boolean isNameUnique(PingTargetData pingTarget) throws RollerException {
         String name = pingTarget.getName();
@@ -248,9 +207,6 @@
      */
     public List getCommonPingTargets() throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingTargetData.class);
             criteria.add(Expression.isNull("website"));
@@ -268,9 +224,6 @@
      */
     public List getCustomPingTargets(WebsiteData website) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingTargetData.class);
             criteria.add(Expression.eq("website", website));

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java Mon Apr 17 08:23:11 2006
@@ -93,46 +93,27 @@
     public void saveGroup(PlanetGroupData group) throws RollerException {
         // TODO: decide how to handle saving members of objects
         // NOTE: with hibernate, cascade="all" should handle this for us
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // save each sub assoc first, then the group
-            Iterator assocs = group.getGroupSubscriptionAssocs().iterator();
-            while (assocs.hasNext()) {
-                PlanetGroupSubscriptionAssoc assoc =
-                        (PlanetGroupSubscriptionAssoc)assocs.next();
-                strategy.store(assoc);
-            }
-            strategy.store(group);
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (HibernateException ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(HibernateException he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
-        }
         
+        // save each sub assoc first, then the group
+        Iterator assocs = group.getGroupSubscriptionAssocs().iterator();
+        while (assocs.hasNext()) {
+            PlanetGroupSubscriptionAssoc assoc =
+                    (PlanetGroupSubscriptionAssoc)assocs.next();
+            strategy.store(assoc);
+        }
+        strategy.store(group);
     }
     
     
     public void saveEntry(PlanetEntryData entry) throws RollerException {
-        strategy.storeAndCommit(entry);
+        strategy.store(entry);
     }
     
     
     public void saveSubscription(PlanetSubscriptionData sub) throws RollerException {
         PlanetSubscriptionData existing = getSubscription(sub.getFeedUrl());
         if (existing == null || (existing.getId().equals(sub.getId()))) {
-            this.strategy.storeAndCommit(sub);
+            this.strategy.store(sub);
         } else {
             throw new RollerException("ERROR: duplicate feed URLs not allowed");
         }
@@ -140,27 +121,24 @@
     
     
     public void deleteEntry(PlanetEntryData entry) throws RollerException {
-        strategy.removeAndCommit(entry);
+        strategy.remove(entry);
     }
     
     
     public void deleteGroup(PlanetGroupData group) throws RollerException {
         // TODO: how to remove hierarchical objects
-        strategy.removeAndCommit(group);
+        strategy.remove(group);
     }
     
     
     public void deleteSubscription(PlanetSubscriptionData sub) throws RollerException {
-        strategy.removeAndCommit(sub);
+        strategy.remove(sub);
     }
     
     
     public PlanetConfigData getConfiguration() throws RollerException {
         PlanetConfigData config = null;
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Criteria criteria = session.createCriteria(PlanetConfigData.class);
             criteria.setMaxResults(1);
@@ -182,9 +160,6 @@
     
     public PlanetSubscriptionData getSubscription(String feedUrl) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Criteria criteria =
                     session.createCriteria(PlanetSubscriptionData.class);
@@ -205,9 +180,6 @@
     
     public Iterator getAllSubscriptions() {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Criteria criteria =
                     session.createCriteria(PlanetSubscriptionData.class);
@@ -222,9 +194,6 @@
     
     public int getSubscriptionCount() throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Integer count = (Integer)session.createQuery(
                     "select count(*) from org.roller.pojos.PlanetSubscriptionData").uniqueResult();
@@ -239,9 +208,6 @@
         String groupHandle = NO_GROUP;
         List ret = null;
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Criteria criteria =
                     session.createCriteria(PlanetSubscriptionData.class);
@@ -259,9 +225,6 @@
         String groupHandle = (group == null) ? NO_GROUP : group.getHandle();
         List ret = null;
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Query query = session.createQuery(
                     "select sub from org.roller.pojos.PlanetSubscriptionData sub "
@@ -281,9 +244,6 @@
     
     public PlanetGroupData getGroup(String handle) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = strategy.getSession();
             Criteria criteria = session.createCriteria(PlanetGroupData.class);
             criteria.setMaxResults(1);
@@ -301,9 +261,6 @@
     
     public List getGroups() throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Criteria criteria = session.createCriteria(PlanetGroupData.class);
             return criteria.list();
@@ -339,9 +296,6 @@
             Session session =
                     ((HibernatePersistenceStrategy)strategy).getSession();
             
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             if (group != null) {
                 Query query = session.createQuery(
                         "select entry from org.roller.pojos.PlanetEntryData entry "
@@ -474,6 +428,7 @@
                 sub.purgeEntries();
                 sub.addEntries(newEntries);
                 this.saveSubscription(sub);
+                if(roller != null) roller.flush();
             }
             long subEndTime = System.currentTimeMillis();
             log.info("   " + count + " - "

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePropertiesManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePropertiesManagerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePropertiesManagerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePropertiesManagerImpl.java Mon Apr 17 08:23:11 2006
@@ -78,9 +78,6 @@
         HashMap props = new HashMap();
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = strategy.getSession();
             Criteria criteria = session.createCriteria(RollerPropertyData.class);
             List list = criteria.list();
@@ -110,7 +107,7 @@
      */
     public void store(RollerPropertyData property) throws RollerException {
         
-        this.strategy.storeAndCommit(property);
+        this.strategy.store(property);
     }
 
     
@@ -119,32 +116,13 @@
      */
     public void store(Map properties) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // just go through the list and store each property
-            Iterator props = properties.values().iterator();
-            while (props.hasNext()) {
-                    this.strategy.store((RollerPropertyData) props.next());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (HibernateException ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(HibernateException he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        // just go through the list and store each property
+        Iterator props = properties.values().iterator();
+        while (props.hasNext()) {
+            this.strategy.store((RollerPropertyData) props.next());
         }
     }
-    
+
     
     private void init() {
         Map props = null;

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateRollerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateRollerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateRollerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateRollerImpl.java Mon Apr 17 08:23:11 2006
@@ -71,6 +71,41 @@
     }
     
     
+    public void flush() throws RollerException {
+        this.strategy.flush();
+    }
+    
+    
+    public void release() {
+        
+        // release our own stuff first
+        if (bookmarkManager != null) bookmarkManager.release();
+        if (configManager != null) configManager.release();
+        if (refererManager != null) refererManager.release();
+        if (userManager != null) userManager.release();
+        if (weblogManager != null) weblogManager.release();
+        if (pingTargetManager != null) pingTargetManager.release();
+        if (pingQueueManager != null) pingQueueManager.release();
+        if (autoPingManager != null) autoPingManager.release();
+        
+        // tell Hibernate to close down
+        this.strategy.release();
+        
+        // then let parent do its thing
+        super.release();
+    }
+    
+    
+    public void shutdown() {
+        
+        // do our own shutdown first
+        this.release();
+        
+        // then let parent do its thing
+        super.shutdown();
+    }
+    
+    
     public void commit() throws RollerException {
         //strategy.commit();
     }
@@ -176,39 +211,6 @@
             pingTargetManager = new HibernatePingTargetManagerImpl(strategy);
         }
         return pingTargetManager;
-    }
-    
-    
-    public void release() {
-        
-        // release our own stuff first
-        if (bookmarkManager != null) bookmarkManager.release();
-        if (configManager != null) configManager.release();
-        if (refererManager != null) refererManager.release();
-        if (userManager != null) userManager.release();
-        if (weblogManager != null) weblogManager.release();
-        if (pingTargetManager != null) pingTargetManager.release();
-        if (pingQueueManager != null) pingQueueManager.release();
-        if (autoPingManager != null) autoPingManager.release();
-        
-        try {
-            if (strategy != null) strategy.release();
-        } catch (Throwable e) {
-            mLogger.error("Error calling Roller.release()", e);
-        }
-        
-        // then let parent do its thing
-        super.release();
-    }
-    
-    
-    public void shutdown() {
-        
-        // do our own shutdown first
-        this.release();
-        
-        // then let parent do its thing
-        super.shutdown();
     }
     
 }

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateUserManagerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateUserManagerImpl.java Mon Apr 17 08:23:11 2006
@@ -65,76 +65,37 @@
      * @see org.roller.model.UserManager#storeWebsite(org.roller.pojos.WebsiteData)
      */
     public void storeWebsite(WebsiteData data) throws RollerException {
-        this.strategy.storeAndCommit(data);
+        this.strategy.store(data);
     }
     
     
     public void storeWebsites(Collection weblogs) throws RollerException {
-        this.strategy.storeAndCommit(weblogs);
+        this.strategy.store(weblogs);
     }
     
     
     public void removeWebsite(String id) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // load the weblog first
-            WebsiteData weblog = (WebsiteData) this.strategy.load(id, WebsiteData.class);
-            
-            // remove contents first, then remove website
-            this.removeWebsiteContents(weblog);
-            this.strategy.remove(weblog);
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
-        }
+        // load the weblog first
+        WebsiteData weblog = (WebsiteData) this.strategy.load(id, WebsiteData.class);
+        
+        // remove it
+        this.removeWebsite(weblog);
     }
     
     
     public void removeWebsite(WebsiteData weblog) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // remove contents first, then remove website
-            this.removeWebsiteContents(weblog);
-            this.strategy.remove(weblog);
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
-        }
+        // remove contents first, then remove website
+        this.removeWebsiteContents(weblog);
+        this.strategy.remove(weblog);
     }
     
-    
+
     /**
      * convenience method for removing contents of a weblog.
      *
-     * TODO BACKEND: we may be able to do this faster using Hibernate delete statements.
+     * TODO BACKEND: use manager methods instead of queries here
      */
     private void removeWebsiteContents(WebsiteData website) 
             throws HibernateException, RollerException {
@@ -218,7 +179,7 @@
     
     
     public void storeUser(UserData data) throws RollerException {
-        this.strategy.storeAndCommit(data);
+        this.strategy.store(data);
     }
     
     
@@ -226,32 +187,32 @@
      * Store a collection of users in a single transaction.
      */
     public void storeUsers(Collection users) throws RollerException {
-        this.strategy.storeAndCommit(users);
+        this.strategy.store(users);
     }
     
     
     public void removeUser(UserData user) throws RollerException {
-        this.strategy.removeAndCommit(user);
+        this.strategy.remove(user);
     }
     
     
     public void removeUser(String id) throws RollerException {
-        this.strategy.removeAndCommit(id,UserData.class);
+        this.strategy.remove(id,UserData.class);
     }
     
     
     public void storePermissions(PermissionsData perms) throws RollerException {
-        this.strategy.storeAndCommit(perms);
+        this.strategy.store(perms);
     }
     
     
     public void storePermissions(Collection permissions) throws RollerException {
-        this.strategy.storeAndCommit(permissions);
+        this.strategy.store(permissions);
     }
     
     
     public void removePermissions(PermissionsData perms) throws RollerException {
-        this.strategy.removeAndCommit(perms);
+        this.strategy.remove(perms);
     }
     
     
@@ -259,12 +220,12 @@
      * @see org.roller.model.UserManager#storePage(org.roller.pojos.WeblogTemplate)
      */
     public void storePage(WeblogTemplate data) throws RollerException {
-        this.strategy.storeAndCommit(data);
+        this.strategy.store(data);
     }
     
     
     public void removePage(WeblogTemplate page) throws RollerException {
-        this.strategy.removeAndCommit(page);
+        this.strategy.remove(page);
     }
     
     
@@ -294,75 +255,36 @@
             adminUser = true;
         }
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
+        UserData newUser = null;
+        Iterator items = users.iterator();
+        while(items.hasNext()) {
+            newUser = (UserData) items.next();
             
-            UserData newUser = null;
-            Iterator items = users.iterator();
-            while(items.hasNext()) {
-                newUser = (UserData) items.next();
-                
-                if(getUser(newUser.getUserName()) != null ||
-                        getUser(newUser.getUserName().toLowerCase()) != null) {
-                    throw new RollerException("error.add.user.userNameInUse");
-                }
-                
-                newUser.grantRole("editor");
-                if(adminUser) {
-                    newUser.grantRole("admin");
-                }
-                
-                this.strategy.store(newUser);
+            if(getUser(newUser.getUserName()) != null ||
+                    getUser(newUser.getUserName().toLowerCase()) != null) {
+                throw new RollerException("error.add.user.userNameInUse");
             }
-
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
             
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
+            newUser.grantRole("editor");
+            if(adminUser) {
+                newUser.grantRole("admin");
             }
             
-            strategy.release();
-            
-            throw new RollerException(ex);
+            this.strategy.store(newUser);
         }
     }
     
     
     public void addWebsites(Collection weblogs) throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // store the new weblogs
-            WebsiteData newWeblog = null;
-            Iterator items = weblogs.iterator();
-            while(items.hasNext()) {
-                newWeblog = (WebsiteData) items.next();
-                
-                this.strategy.store(newWeblog);
-                this.addWeblogContents(newWeblog);
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
+        // store the new weblogs
+        WebsiteData newWeblog = null;
+        Iterator items = weblogs.iterator();
+        while(items.hasNext()) {
+            newWeblog = (WebsiteData) items.next();
             
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+            this.strategy.store(newWeblog);
+            this.addWeblogContents(newWeblog);
         }
     }
     
@@ -377,7 +299,7 @@
     }
     
     
-    private void addWeblogContents(WebsiteData newWeblog) throws Exception {
+    private void addWeblogContents(WebsiteData newWeblog) throws RollerException {
         
         UserManager umgr = RollerFactory.getRoller().getUserManager();
         WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
@@ -448,6 +370,8 @@
     
     /**
      * The old createWebsite() method.
+     *
+     * TODO BACKEND: EOL this method.
      */
     public WebsiteData createWebsite(UserData user, Map pages, String handle,
                                      String name, String description, 
@@ -500,7 +424,7 @@
         perms.setWebsite(website);
         perms.setUser(user);
         perms.setPermissionMask(mask);
-        this.strategy.storeAndCommit(perms);
+        this.strategy.store(perms);
         
         return perms;
     }
@@ -509,7 +433,7 @@
     /**
      * Remove user permissions from a website.
      *
-     * TODO BACKEND: EOL this method?  we can just use storePermission()
+     * TODO: replace this with a domain model method like weblog.retireUser(user)
      */
     public void retireUser(WebsiteData website, UserData user) throws RollerException {
         
@@ -528,12 +452,12 @@
         if (target == null) throw new RollerException("User not member of website");
         
         website.removePermission(target);
-        this.strategy.removeAndCommit(target);
+        this.strategy.remove(target);
     }
     
     
     public WebsiteData retrieveWebsite(String id) throws RollerException {
-        return (WebsiteData)this.strategy.load(id,WebsiteData.class);
+        return (WebsiteData) this.strategy.load(id,WebsiteData.class);
     }
     
     
@@ -552,9 +476,6 @@
             throw new RollerException("Handle cannot be null");
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WebsiteData.class);
             if (enabled != null) {
@@ -581,9 +502,6 @@
     public List getWebsites(UserData user, Boolean enabled, Boolean active)  throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WebsiteData.class);
             if (user != null) {
@@ -621,9 +539,6 @@
             throw new RollerException("userName cannot be null");
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(UserData.class);
             if (enabled != null) {
@@ -651,9 +566,6 @@
     public List getUsers(Boolean enabled) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(UserData.class);
             if (enabled != null) {
@@ -673,9 +585,6 @@
     public List getUsers(WebsiteData website, Boolean enabled) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(UserData.class);
             if (website != null) {
@@ -698,9 +607,6 @@
         List rawresults = new ArrayList();
         List results = new ArrayList();
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(UserData.class);
             
@@ -752,9 +658,6 @@
             throw new RollerException("Pagelink is null");
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogTemplate.class);
             criteria.add(Expression.eq("website",website));
@@ -782,9 +685,6 @@
             throw new RollerException("Page name is null");
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogTemplate.class);
             criteria.add(Expression.eq("website", website));
@@ -808,9 +708,6 @@
             throw new RollerException("website is null");
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogTemplate.class);
             criteria.add(Expression.eq("website",website));
@@ -835,9 +732,6 @@
             WebsiteData website, UserData user) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(PermissionsData.class);
             criteria.add(Expression.eq("website", website));
@@ -857,9 +751,6 @@
     public List getPendingPermissions(UserData user) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(PermissionsData.class);
             criteria.add(Expression.eq("user", user));
@@ -878,9 +769,6 @@
     public List getPendingPermissions(WebsiteData website) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(PermissionsData.class);
             criteria.add(Expression.eq("website", website));
@@ -899,9 +787,6 @@
     public List getAllPermissions(WebsiteData website) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(PermissionsData.class);
             criteria.add(Expression.eq("website", website));
@@ -920,9 +805,6 @@
     public List getAllPermissions(UserData user) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(PermissionsData.class);
             criteria.add(Expression.eq("user", user));

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java Mon Apr 17 08:23:11 2006
@@ -85,7 +85,7 @@
             throw new RollerException("Duplicate category name");
         }
         
-        this.strategy.storeAndCommit(cat);
+        this.strategy.store(cat);
     }
     
     
@@ -95,43 +95,21 @@
             throw new RollerException("Cannot remove category with entries");
         }
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // remove cat
-            this.strategy.remove(cat);
-            
-            // update website default cats if needed
-            if(cat.getWebsite().getBloggerCategory().equals(cat)) {
-                WeblogCategoryData rootCat = this.getRootWeblogCategory(cat.getWebsite());
-                cat.getWebsite().setBloggerCategory(rootCat);
-                this.strategy.store(cat.getWebsite());
-            }
-            
-            if(cat.getWebsite().getDefaultCategory().equals(cat)) {
-                WeblogCategoryData rootCat = this.getRootWeblogCategory(cat.getWebsite());
-                cat.getWebsite().setDefaultCategory(rootCat);
-                this.strategy.store(cat.getWebsite());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
-        }
-        
+        // remove cat
+        this.strategy.remove(cat);
         
+        // update website default cats if needed
+        if(cat.getWebsite().getBloggerCategory().equals(cat)) {
+            WeblogCategoryData rootCat = this.getRootWeblogCategory(cat.getWebsite());
+            cat.getWebsite().setBloggerCategory(rootCat);
+            this.strategy.store(cat.getWebsite());
+        }
         
+        if(cat.getWebsite().getDefaultCategory().equals(cat)) {
+            WeblogCategoryData rootCat = this.getRootWeblogCategory(cat.getWebsite());
+            cat.getWebsite().setDefaultCategory(rootCat);
+            this.strategy.store(cat.getWebsite());
+        }
     }
     
     
@@ -151,77 +129,58 @@
     public void moveWeblogCategoryContents(String srcId, String destId)
             throws RollerException {
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            WeblogCategoryData srcCd =
-                    (WeblogCategoryData) this.strategy.load(
-                    srcId, WeblogCategoryData.class);
-            
-            WeblogCategoryData destCd =
-                    (WeblogCategoryData) this.strategy.load(
-                    destId, WeblogCategoryData.class);
-            
-            // TODO: this check should be made before calling this method?
-            if (destCd.descendentOf(srcCd)) {
-                throw new RollerException(
-                        "ERROR cannot move parent category into it's own child");
-            }
-            
-            // get all entries in category and subcats
-            List results = retrieveWeblogEntries(srcCd, true);
-            
-            // Loop through entries in src cat, assign them to dest cat
-            Iterator iter = results.iterator();
-            WebsiteData website = destCd.getWebsite();
-            while (iter.hasNext()) {
-                WeblogEntryData entry = (WeblogEntryData) iter.next();
-                entry.setCategory(destCd);
-                entry.setWebsite(website);
-                this.strategy.store(entry);
-            }
-            
-            // Make sure website's default and bloggerapi categories
-            // are valid after the move
-            
-            if (srcCd.getWebsite().getDefaultCategory().getId().equals(srcId)
-            || srcCd.getWebsite().getDefaultCategory().descendentOf(srcCd)) {
-                srcCd.getWebsite().setDefaultCategory(destCd);
-                this.strategy.store(srcCd.getWebsite());
-            }
-            
-            if (srcCd.getWebsite().getBloggerCategory().getId().equals(srcId)
-            || srcCd.getWebsite().getBloggerCategory().descendentOf(srcCd)) {
-                srcCd.getWebsite().setBloggerCategory(destCd);
-                this.strategy.store(srcCd.getWebsite());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        WeblogCategoryData srcCd =
+                (WeblogCategoryData) this.strategy.load(
+                srcId, WeblogCategoryData.class);
+        
+        WeblogCategoryData destCd =
+                (WeblogCategoryData) this.strategy.load(
+                destId, WeblogCategoryData.class);
+        
+        // TODO: this check should be made before calling this method?
+        if (destCd.descendentOf(srcCd)) {
+            throw new RollerException(
+                    "ERROR cannot move parent category into it's own child");
+        }
+        
+        // get all entries in category and subcats
+        List results = retrieveWeblogEntries(srcCd, true);
+        
+        // Loop through entries in src cat, assign them to dest cat
+        Iterator iter = results.iterator();
+        WebsiteData website = destCd.getWebsite();
+        while (iter.hasNext()) {
+            WeblogEntryData entry = (WeblogEntryData) iter.next();
+            entry.setCategory(destCd);
+            entry.setWebsite(website);
+            this.strategy.store(entry);
+        }
+        
+        // Make sure website's default and bloggerapi categories
+        // are valid after the move
+        
+        if (srcCd.getWebsite().getDefaultCategory().getId().equals(srcId)
+        || srcCd.getWebsite().getDefaultCategory().descendentOf(srcCd)) {
+            srcCd.getWebsite().setDefaultCategory(destCd);
+            this.strategy.store(srcCd.getWebsite());
+        }
+        
+        if (srcCd.getWebsite().getBloggerCategory().getId().equals(srcId)
+        || srcCd.getWebsite().getBloggerCategory().descendentOf(srcCd)) {
+            srcCd.getWebsite().setBloggerCategory(destCd);
+            this.strategy.store(srcCd.getWebsite());
         }
     }
     
     
     // TODO BACKEND: rename to storeComment() for consistency
     public void saveComment(CommentData comment) throws RollerException {
-        this.strategy.storeAndCommit(comment);
+        this.strategy.store(comment);
     }
     
     
     public void removeComment(String id) throws RollerException {
-        this.strategy.removeAndCommit(id, CommentData.class);
+        this.strategy.remove(id, CommentData.class);
     }
     
     
@@ -233,28 +192,9 @@
             return;
         }
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // just go through the list and remove each id
-            for(int i=0; i < ids.length; i++) {
-                    this.strategy.remove(ids[i], CommentData.class);
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        // just go through the list and remove each id
+        for(int i=0; i < ids.length; i++) {
+            this.strategy.remove(ids[i], CommentData.class);
         }
     }
     
@@ -291,29 +231,10 @@
             return;
         }
         
-        try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // just go through the list and remove each commentsIT
-            Iterator commentsIT = comments.iterator();
-            while (commentsIT.hasNext()) {
-                    this.strategy.remove((CommentData) commentsIT.next());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        // just go through the list and remove each commentsIT
+        Iterator commentsIT = comments.iterator();
+        while (commentsIT.hasNext()) {
+            this.strategy.remove((CommentData) commentsIT.next());
         }
     }
     
@@ -324,7 +245,7 @@
             entry.setAnchor(this.createAnchor(entry));
         }
         
-        this.strategy.storeAndCommit(entry);
+        this.strategy.store(entry);
         
         if(entry.isPublished()) {
             // Queue applicable pings for this update.
@@ -335,112 +256,73 @@
     
     public void removeWeblogEntry(WeblogEntryData entry) throws RollerException {
         
-        try {
-            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // remove referers
-            Criteria refererQuery = session.createCriteria(RefererData.class);
-            refererQuery.add(Expression.eq("weblogEntry", entry));
-            List referers = refererQuery.list();
-            for (Iterator iter = referers.iterator(); iter.hasNext();) {
-                RefererData referer = (RefererData) iter.next();
-                this.strategy.remove(referer);
-            }
-            
-            // remove comments
-            List comments = getComments(
-                    null,  // website
-                    entry,
-                    null,  // search String
-                    null,  // startDate
-                    null,  // endDate
-                    null,  // pending
-                    null,  // approved
-                    null,  // spam
-                    true,  // reverse chrono order (not that it matters)
-                    0,     // offset
-                    -1);   // no limit
-            Iterator commentsIT = comments.iterator();
-            while (commentsIT.hasNext()) {
-                    this.strategy.remove((CommentData) commentsIT.next());
-            }
-            
-            // remove entry
-            this.strategy.remove(entry);
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
+        
+        // remove referers
+        Criteria refererQuery = session.createCriteria(RefererData.class);
+        refererQuery.add(Expression.eq("weblogEntry", entry));
+        List referers = refererQuery.list();
+        for (Iterator iter = referers.iterator(); iter.hasNext();) {
+            RefererData referer = (RefererData) iter.next();
+            this.strategy.remove(referer);
+        }
+        
+        // remove comments
+        List comments = getComments(
+                null,  // website
+                entry,
+                null,  // search String
+                null,  // startDate
+                null,  // endDate
+                null,  // pending
+                null,  // approved
+                null,  // spam
+                true,  // reverse chrono order (not that it matters)
+                0,     // offset
+                -1);   // no limit
+        Iterator commentsIT = comments.iterator();
+        while (commentsIT.hasNext()) {
+            this.strategy.remove((CommentData) commentsIT.next());
         }
+        
+        // remove entry
+        this.strategy.remove(entry);
     }
     
     
-    private void removeWeblogEntryContents(WeblogEntryData entry)
-            throws RollerException {
+    private void removeWeblogEntryContents(WeblogEntryData entry) throws RollerException {
         
         if(entry == null) {
             throw new RollerException("cannot remove null entry");
         }
         
-        try {
-            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
-            // remove referers
-            Criteria refererQuery = session.createCriteria(RefererData.class);
-            refererQuery.add(Expression.eq("weblogEntry", entry));
-            List referers = refererQuery.list();
-            for (Iterator iter = referers.iterator(); iter.hasNext();) {
-                RefererData referer = (RefererData) iter.next();
-                this.strategy.remove(referer);
-            }
-            
-            // remove comments
-            List comments = getComments(
-                    null,  // website
-                    entry,
-                    null,  // search String
-                    null,  // startDate
-                    null,  // endDate
-                    null,  // pending
-                    null,  // approved
-                    null,  // spam
-                    true,  // reverse chrono order (not that it matters)
-                    0,     // offset
-                    -1);   // no limit
-            Iterator commentsIT = comments.iterator();
-            while (commentsIT.hasNext()) {
-                    this.strategy.remove((CommentData) commentsIT.next());
-            }
-            
-            // commit changes
-            this.strategy.getSession().getTransaction().commit();
-        } catch (Throwable ex) {
-            
-            try {
-                this.strategy.getSession().getTransaction().rollback();
-            } catch(Throwable he) {
-                log.error("Error doing rollback", he);
-            }
-            
-            strategy.release();
-            
-            throw new RollerException(ex);
+        Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
+        
+        // remove referers
+        Criteria refererQuery = session.createCriteria(RefererData.class);
+        refererQuery.add(Expression.eq("weblogEntry", entry));
+        List referers = refererQuery.list();
+        for (Iterator iter = referers.iterator(); iter.hasNext();) {
+            RefererData referer = (RefererData) iter.next();
+            this.strategy.remove(referer);
+        }
+        
+        // remove comments
+        List comments = getComments(
+                null,  // website
+                entry,
+                null,  // search String
+                null,  // startDate
+                null,  // endDate
+                null,  // pending
+                null,  // approved
+                null,  // spam
+                true,  // reverse chrono order (not that it matters)
+                0,     // offset
+                -1);   // no limit
+        Iterator commentsIT = comments.iterator();
+        while (commentsIT.hasNext()) {
+            this.strategy.remove((CommentData) commentsIT.next());
         }
     }
     
@@ -472,9 +354,6 @@
         }
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogEntryData.class);
             criteria.addOrder(next ? Order.asc("pubTime") : Order.desc("pubTime"));
@@ -493,9 +372,6 @@
             throw new RollerException("website is null");
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
             criteria.createAlias("category","c");
@@ -521,9 +397,6 @@
         if (includeRoot) return getWeblogCategories(website);
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
             criteria.createAlias("category", "c");
@@ -547,9 +420,6 @@
             throw new RollerException("website is null");
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryData.class);
             criteria.add(Expression.eq("website", website));
@@ -577,9 +447,6 @@
         }
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogEntryData.class);
             
@@ -626,9 +493,6 @@
     
     public List getWeblogEntriesPinnedToMain(Integer max) throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogEntryData.class);
             criteria.add(Expression.eq("pinnedToMain", Boolean.TRUE));
@@ -653,9 +517,6 @@
         
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogEntryData.class);
             criteria.add(Expression.conjunction()
@@ -684,9 +545,6 @@
         }
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogEntryData.class);
             criteria.add(Expression.eq("status", WeblogEntryData.PUBLISHED));
@@ -718,9 +576,6 @@
     public List retrieveWeblogEntries(WeblogCategoryData cat, boolean subcats)
     throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             List entries = new LinkedList();
             
@@ -773,9 +628,6 @@
                     name = base + count;
                 }
                 
-                // begin transaction
-                this.strategy.getSession().beginTransaction();
-            
                 Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
                 Criteria criteria = session.createCriteria(WeblogEntryData.class);
                 criteria.add(Expression.eq("website", entry.getWebsite()));
@@ -805,9 +657,6 @@
         {
             List sameNames;
             try {
-                // begin transaction
-                this.strategy.getSession().beginTransaction();
-            
                 Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
                 Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
                 criteria.createAlias("category", "c");
@@ -828,9 +677,6 @@
     public boolean isWeblogCategoryInUse(WeblogCategoryData cat)
     throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogEntryData.class);
             criteria.add(Expression.eq("category", cat));
@@ -868,9 +714,6 @@
             throws RollerException {
         boolean ret = false;
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
             criteria.add(Expression.eq("category", child));
@@ -885,9 +728,6 @@
     public Assoc getWeblogCategoryParentAssoc(WeblogCategoryData cat)
     throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
             criteria.add(Expression.eq("category", cat));
@@ -908,9 +748,6 @@
     public List getWeblogCategoryChildAssocs(WeblogCategoryData cat)
     throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
             criteria.add(Expression.eq("ancestorCategory", cat));
@@ -924,9 +761,6 @@
     public List getAllWeblogCategoryDecscendentAssocs(WeblogCategoryData cat)
     throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
             criteria.add(Expression.eq("ancestorCategory", cat));
@@ -939,9 +773,6 @@
     public List getWeblogCategoryAncestorAssocs(WeblogCategoryData cat)
     throws RollerException {
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
             criteria.add(Expression.eq("category", cat));
@@ -966,9 +797,6 @@
             ) throws RollerException {
         
         try {
-            // begin transaction
-            this.strategy.getSession().beginTransaction();
-            
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(CommentData.class);
             
@@ -1272,11 +1100,3 @@
     public void release() {}
     
 }
-
-
-
-
-
-
-
-

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/model/Roller.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/model/Roller.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/model/Roller.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/model/Roller.java Mon Apr 17 08:23:11 2006
@@ -9,10 +9,8 @@
 
 /** 
  * The main entry point interface of the Roller business tier.
- *
- * @author David M Johnson
  */
-public interface Roller extends Serializable {
+public interface Roller {
     
     
     /** 
@@ -121,6 +119,12 @@
      * Upgrade database if needed.
      */
     public void upgradeDatabase(Connection con) throws RollerException;
+    
+    
+    /**
+     * Flush object states.
+     */
+    public void flush() throws RollerException;
     
     
     /**

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/presentation/RollerContext.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/presentation/RollerContext.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/presentation/RollerContext.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/presentation/RollerContext.java Mon Apr 17 08:23:11 2006
@@ -172,6 +172,7 @@
             setupPingQueueTask(roller);
             setupScheduledTasks(mContext, roller);
             
+            roller.flush();
             roller.commit();
             roller.release();
             

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/presentation/TurnoverReferersTask.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/presentation/TurnoverReferersTask.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/presentation/TurnoverReferersTask.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/presentation/TurnoverReferersTask.java Mon Apr 17 08:23:11 2006
@@ -41,6 +41,7 @@
         try {
             Roller roller = RollerFactory.getRoller();
             roller.getRefererManager().clearReferrers();
+            roller.flush();
             roller.commit();
             roller.release();
             mLogger.info("task completed");   

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueTask.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueTask.java?rev=394696&r1=394695&r2=394696&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueTask.java (original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueTask.java Mon Apr 17 08:23:11 2006
@@ -63,6 +63,7 @@
             roller = RollerFactory.getRoller();
             //roller.begin();
             PingQueueProcessor.getInstance().processQueue();
+            roller.flush();
             roller.commit();
         }
         catch (RollerException e)



Mime
View raw message