You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/11/15 20:14:26 UTC

svn commit: r475368 [1/2] - in /incubator/roller/trunk: metadata/database/ metadata/database/hibernate/ src/org/apache/roller/business/ src/org/apache/roller/business/hibernate/ src/org/apache/roller/pojos/ src/org/apache/roller/ui/authoring/struts/for...

Author: agilliland
Date: Wed Nov 15 11:14:24 2006
New Revision: 475368

URL: http://svn.apache.org/viewvc?view=rev&rev=475368
Log:
Reworking the hierarchical objects persistence model and enabling lazy fetching for all single and collection-valued associations in Hibernate.

I. Remodeled weblog category data model to remove use of HierarchicalPersistenObject and Assoc classes.

  * Each category now points to its parent and children through the parentid column of the weblogcategory table.
  * Did a little cleanup on unit tests to reflect this change.
  * Removed all code which dealt with WeblogCategoryAssoc objects.


II. Remodeled folder/bookmarks data model to remove use of HierarchicalPersistentObject and Assoc classes.

  * Same as weblog categories, uses a parentid column to reference parent and child relationships.
  * Did some cleanup on unit tests.
  * Removed all code which dealt with FolderAssoc objects.


III. Removed HierarchicalPersistentObject and Assoc classes since they were no longer needed.

  * Removed all code which used these objects and delete the classes.


IV. Enabled Hibernate lazy fetching for all pojos so that associations can be fetched in a lazy manner.

  * All this really required was changing the xdoclet marked in a variety of the pojo classes.


V. Modified RollerSession to only reference a user id string, not the UserData object itself.

  * This is required to prevent lazy initialization exceptions from Hibernate because the stored UserData object is a detached object and thus referencing its Roles or Permissions associations later in the session causes problems.  The fix was simply to store the id and to load the actual UserData object using the id when it is needed.


Added:
    incubator/roller/trunk/metadata/database/310-to-320-migration.vm
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java
Removed:
    incubator/roller/trunk/src/org/apache/roller/pojos/Assoc.java
    incubator/roller/trunk/src/org/apache/roller/pojos/FolderAssoc.java
    incubator/roller/trunk/src/org/apache/roller/pojos/HierarchicalPersistentObject.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryAssoc.java
Modified:
    incubator/roller/trunk/metadata/database/createdb.vm
    incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml
    incubator/roller/trunk/src/org/apache/roller/business/BookmarkManager.java
    incubator/roller/trunk/src/org/apache/roller/business/ThemeManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/UserData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagAggregateData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogTemplate.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java
    incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogCategoryFormEx.java
    incubator/roller/trunk/src/org/apache/roller/ui/core/RollerSession.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/plugins/BookmarkPlugin.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
    incubator/roller/trunk/tests/org/apache/roller/TestUtils.java
    incubator/roller/trunk/tests/org/apache/roller/business/BookmarkTest.java
    incubator/roller/trunk/tests/org/apache/roller/business/WeblogCategoryTest.java

Added: incubator/roller/trunk/metadata/database/310-to-320-migration.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/310-to-320-migration.vm?view=auto&rev=475368
==============================================================================
--- incubator/roller/trunk/metadata/database/310-to-320-migration.vm (added)
+++ incubator/roller/trunk/metadata/database/310-to-320-migration.vm Wed Nov 15 11:14:24 2006
@@ -0,0 +1,21 @@
+#** 
+310-to-320-migration.vm: Velocity template that generates vendor-specific database scripts 
+
+DON'T RUN THIS, IT'S NOT A DATABASE CREATION SCRIPT!!!
+**#
+
+# add new parentid column to weblogcategory table
+#addColumnNull("weblogcategory" "parentid" "varchar(48)")
+
+
+# this needs to be done in a database independent manner before releasing
+update weblogcategory,weblogcategoryassoc 
+set weblogcategory.parentid = weblogcategoryassoc.ancestorid 
+where weblogcategory.id = weblogcategoryassoc.categoryid 
+and weblogcategoryassoc.relation = 'PARENT';
+
+# also need to set proper parentid for folders
+update folder,folderassoc 
+set folder.parentid = folderassoc.ancestorid 
+where folder.id = folderassoc.folderid 
+and folderassoc.relation = 'PARENT';

Modified: incubator/roller/trunk/metadata/database/createdb.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/createdb.vm?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/metadata/database/createdb.vm (original)
+++ incubator/roller/trunk/metadata/database/createdb.vm Wed Nov 15 11:14:24 2006
@@ -161,7 +161,8 @@
     name             varchar(255) not null,
     description      varchar(255),
     websiteid        varchar(48)  not null,
-    image            varchar(255)
+    image            varchar(255),
+    parentid         varchar(48)
 );
 create index wc_websiteid_idx on weblogcategory( websiteid );
 -- alter table weblogcategory add unique category_nameparentid_uq (parentid, name(20));

Modified: incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml (original)
+++ incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml Wed Nov 15 11:14:24 2006
@@ -30,8 +30,9 @@
                        
         <property name="show_sql">false</property>
 
-        <!-- use thread local Session context -->
-        <property name="hibernate.current_session_context_class">thread</property>
+        <!-- use custom thread local Session context -->
+        <!--<property name="hibernate.current_session_context_class">thread</property>-->
+        <property name="hibernate.current_session_context_class">org.apache.roller.business.hibernate.ThreadLocalSessionContextNoAutoClose</property>
 
         <!-- Hibernate L2 Caching -->
         <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
@@ -49,7 +50,6 @@
         <mapping resource="org/apache/roller/pojos/PermissionsData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/BookmarkData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/CommentData.hbm.xml" />
-        <mapping resource="org/apache/roller/pojos/FolderAssoc.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/FolderData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/WeblogTemplate.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/PingCategoryRestrictionData.hbm.xml" />
@@ -65,7 +65,6 @@
         <mapping resource="org/apache/roller/pojos/WeblogEntryTagAggregateData.hbm.xml" />                       
         <mapping resource="org/apache/roller/pojos/EntryAttributeData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/WeblogCategoryData.hbm.xml" />
-        <mapping resource="org/apache/roller/pojos/WeblogCategoryAssoc.hbm.xml" />
         
         <mapping resource="org/apache/roller/planet/pojos/PlanetConfigData.hbm.xml" />
         <mapping resource="org/apache/roller/planet/pojos/PlanetGroupData.hbm.xml" />

Modified: incubator/roller/trunk/src/org/apache/roller/business/BookmarkManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/BookmarkManager.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/BookmarkManager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/BookmarkManager.java Wed Nov 15 11:14:24 2006
@@ -20,7 +20,6 @@
 
 import java.util.List;
 import org.apache.roller.RollerException;
-import org.apache.roller.pojos.Assoc;
 import org.apache.roller.pojos.BookmarkData;
 import org.apache.roller.pojos.FolderData;
 import org.apache.roller.pojos.WebsiteData;
@@ -129,29 +128,6 @@
      * Check duplicate folder name.
      */
     public boolean isDuplicateFolderName(FolderData data) throws RollerException;
-    
-    
-    /**
-     * Determines if folder is descendent of folder.
-     */
-    public boolean isDescendentOf(FolderData data, FolderData ancestor) throws RollerException;
-    
-    
-    /**
-     */
-    public Assoc getFolderParentAssoc(FolderData data) throws RollerException;
-    
-    /**
-     */
-    public List getFolderChildAssocs(FolderData data) throws RollerException;
-    
-    /**
-     */
-    public List getAllFolderDecscendentAssocs(FolderData data) throws RollerException;
-    
-    /**
-     */
-    public List getFolderAncestorAssocs(FolderData data) throws RollerException;
     
     
     /** 

Modified: incubator/roller/trunk/src/org/apache/roller/business/ThemeManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/ThemeManagerImpl.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/ThemeManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/ThemeManagerImpl.java Wed Nov 15 11:14:24 2006
@@ -187,34 +187,21 @@
                             theme_template.getDecoratorName()   // decorator
                             );
                     userMgr.savePage( template );
+                    
+                    // we just created and saved the default page for the first
+                    // time then we need to set website.defaultpageid
+                    if(theme_template.getName().equals(WeblogTemplate.DEFAULT_PAGE)) {
+                        website.setDefaultPageId(template.getId());
+                        
+                        // update this website's theme to custom
+                        website.setEditorTheme(Theme.CUSTOM);
+                        
+                        // save our updated website
+                        userMgr.saveWebsite(website);
+                    }
                 }
             }
             
-            // now update this website's theme to custom
-            website.setEditorTheme(Theme.CUSTOM);
-            
-            // if this is the first time someone is customizing a theme then
-            // we need to set a default page
-            if(website.getDefaultPageId() == null ||
-                    website.getDefaultPageId().trim().equals("") ||
-                    website.getDefaultPageId().equals("dummy")) {
-                // we have to go back to the db to figure out the id
-                WeblogTemplate template = userMgr.getPageByName(website, "Weblog");
-                if(template != null) {
-                    log.debug("Setting default page to "+template.getId());
-                    website.setDefaultPageId(template.getId());
-                }
-            }
-            
-            // we also want to set the weblogdayid
-            WeblogTemplate dayTemplate = userMgr.getPageByName(website, "_day");
-            if(dayTemplate != null) {
-                log.debug("Setting default day page to "+dayTemplate.getId());
-                website.setWeblogDayPageId(dayTemplate.getId());
-            }
-            
-            // save our updated website
-            userMgr.saveWebsite(website);
             
             // now lets import all the theme resources
             FileManager fileMgr = RollerFactory.getRoller().getFileManager();

Modified: incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java Wed Nov 15 11:14:24 2006
@@ -22,7 +22,6 @@
 import java.util.List;
 import java.util.Map;
 import org.apache.roller.RollerException;
-import org.apache.roller.pojos.Assoc;
 import org.apache.roller.pojos.CommentData;
 import org.apache.roller.pojos.HitCountData;
 import org.apache.roller.pojos.UserData;
@@ -35,8 +34,6 @@
  * Interface to weblog entry, category and comment management.
  */
 public interface WeblogManager {
-    
-    public static final String CATEGORY_ATT = "category.att";
        
     /**
      * Save weblog entry.
@@ -278,33 +275,7 @@
      */
     public List getWeblogCategories(WebsiteData website, boolean includeRoot)
             throws RollerException;
-        
-    /**
-     * Get absolute path to category, appropriate for use by getWeblogCategoryByPath().
-     * @param category WeblogCategoryData.
-     * @return         Forward slash separated path string.
-     */
-    public String getPath(WeblogCategoryData category) throws RollerException;
     
-    /**
-     * Get parent association for a category.
-     */
-    public Assoc getWeblogCategoryParentAssoc(WeblogCategoryData data) throws RollerException;
-    
-    /**
-     * Get child associations for a category.
-     */
-    public List getWeblogCategoryChildAssocs(WeblogCategoryData data) throws RollerException;
-    
-    /** 
-     * Get all descendent associations for a category.
-     */
-    public List getAllWeblogCategoryDecscendentAssocs(WeblogCategoryData data) throws RollerException;
-    
-    /**
-     * Get all ancestor associates for a category.
-     */
-    public List getWeblogCategoryAncestorAssocs(WeblogCategoryData data) throws RollerException;
                
     /**
      * Save comment.
@@ -386,11 +357,6 @@
     public boolean isWeblogCategoryInUse(WeblogCategoryData data)
             throws RollerException;    
     
-    /**
-     * Returns true if ancestor is truly an ancestor of child.
-     */
-    public boolean isDescendentOf(WeblogCategoryData child, 
-            WeblogCategoryData ancestor) throws RollerException;
     
     /**
      * Apply comment default settings from website to all of website's entries.

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java Wed Nov 15 11:14:24 2006
@@ -1,23 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Jun 18, 2004
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
+
 package org.apache.roller.business.hibernate;
 
 import java.io.StringReader;
@@ -26,9 +24,7 @@
 import org.hibernate.Session;
 import org.hibernate.criterion.Expression;
 import org.apache.roller.RollerException;
-import org.apache.roller.pojos.Assoc;
 import org.apache.roller.pojos.BookmarkData;
-import org.apache.roller.pojos.FolderAssoc;
 import org.apache.roller.pojos.FolderData;
 import org.apache.roller.pojos.WebsiteData;
 import java.util.Iterator;
@@ -91,12 +87,10 @@
         RollerFactory.getRoller().getUserManager().saveWebsite(bookmark.getWebsite());
     }
     
-    //------------------------------------------------------------ Folder CRUD
-    
     
     public void saveFolder(FolderData folder) throws RollerException {
         
-        if(isDuplicateFolderName(folder)) {
+        if(folder.getId() == null && isDuplicateFolderName(folder)) {
             throw new RollerException("Duplicate folder name");
         }
         
@@ -210,7 +204,7 @@
         }
     }
     
-    //----------------------------------------------------------------
+    
     public void moveFolderContents(FolderData src, FolderData dest)
             throws RollerException {
         
@@ -219,37 +213,21 @@
                     "ERROR cannot move parent folder into it's own child");
         }
         
-        try {
-            // Add to destination folder
-            LinkedList deleteList = new LinkedList();
-            Iterator srcBookmarks = src.getBookmarks().iterator();
-            while (srcBookmarks.hasNext()) {
-                BookmarkData bd = (BookmarkData)srcBookmarks.next();
-                deleteList.add(bd);
-                
-                BookmarkData movedBd = new BookmarkData();
-                movedBd.setData(bd);
-                movedBd.setId(null);
-                
-                dest.addBookmark(movedBd);
-                this.strategy.store(movedBd);
-            }
-            
-            // Remove from source folder
-            Iterator deleteIter = deleteList.iterator();
-            while (deleteIter.hasNext()) {
-                BookmarkData bd = (BookmarkData)deleteIter.next();
-                src.removeBookmark(bd);
-                // TODO: this won't conflict with the bookmark we store above right?
-                this.strategy.remove(bd);
-            }
+        // iterator over src bookmarks and add them to dest
+        BookmarkData bookmark = null;
+        Iterator srcBookmarks = src.getBookmarks().iterator();
+        while(srcBookmarks.hasNext()) {
+            bookmark = (BookmarkData) srcBookmarks.next();
             
-        } catch (Exception ex) {
-            throw new RollerException(ex);
+            // add to dest
+            dest.addBookmark(bookmark);
         }
+        
+        // now just save the dest folder
+        this.saveFolder(dest);
     }
     
-    //----------------------------------------------------------------
+    
     public void removeFolderContents(FolderData src) throws RollerException {
         
         // just go through the folder and remove each bookmark
@@ -260,7 +238,6 @@
         }
     }
     
-    //---------------------------------------------------------------- Queries
     
     public FolderData getFolder(WebsiteData website, String folderPath)
     throws RollerException {
@@ -314,12 +291,6 @@
         return null;
     }
     
-    //----------------------------------------------- FolderAssoc CRUD
-    
-    
-    public FolderAssoc retrieveFolderAssoc(String id) throws RollerException {
-        return (FolderAssoc)strategy.load(id, FolderAssoc.class);
-    }
     
     public void release() {}
     
@@ -328,66 +299,42 @@
      *      org.apache.roller.pojos.FolderData, boolean)
      */
     public List getBookmarks(FolderData folder, boolean subfolders)
-    throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy) strategy).getSession();
-            List bookmarks = new LinkedList();
-            if (subfolders) {
-                // get bookmarks in subfolders
-                Criteria assocsQuery = session
-                        .createCriteria(FolderAssoc.class);
-                assocsQuery.add(Expression.eq("ancestorFolder", folder));
-                Iterator assocs = assocsQuery.list().iterator();
-                while (assocs.hasNext()) {
-                    FolderAssoc assoc = (FolderAssoc) assocs.next();
-                    Criteria bookmarksQuery = session
-                            .createCriteria(BookmarkData.class);
-                    bookmarksQuery.add(Expression.eq("folder", assoc
-                            .getFolder()));
-                    Iterator bookmarkIter = bookmarksQuery.list().iterator();
-                    while (bookmarkIter.hasNext()) {
-                        BookmarkData entry = (BookmarkData) bookmarkIter.next();
-                        bookmarks.add(entry);
-                    }
-                }
-            }
-            
-            // get bookmarks in folder
-            Criteria bookmarksQuery = session
-                    .createCriteria(BookmarkData.class);
-            bookmarksQuery.add(Expression.eq("folder", folder));
-            Iterator bookmarkIter = bookmarksQuery.list().iterator();
-            while (bookmarkIter.hasNext()) {
-                BookmarkData bookmark = (BookmarkData) bookmarkIter.next();
-                bookmarks.add(bookmark);
+            throws RollerException {
+        
+        List bkmrks = new LinkedList();
+        
+        // Get bookmarks in current folder
+        bkmrks.addAll(folder.getBookmarks());
+        
+        if (subfolders) {
+            // recursive call for child folders
+            FolderData childFolder = null;
+            Iterator childFolders = folder.getFolders().iterator();
+            while(childFolders.hasNext()) {
+                childFolder = (FolderData) childFolders.next();
+                
+                bkmrks.addAll(this.getBookmarks(childFolder, subfolders));
             }
-            return bookmarks;
-        } catch (HibernateException e) {
-            throw new RollerException(e);
         }
+        
+        return bkmrks;
     }
     
     public FolderData getRootFolder(WebsiteData website) throws RollerException {
+        
         if (website == null)
             throw new RollerException("website is null");
+        
         try {
-            Session session = ((HibernatePersistenceStrategy) strategy).getSession();
-            Criteria criteria = session.createCriteria(FolderAssoc.class);
-            criteria.createAlias("folder", "f");
-            criteria.add(Expression.eq("f.website", website));
-            criteria.add(Expression.isNull("ancestorFolder"));
-            criteria.add(Expression.eq("relation", FolderAssoc.PARENT));
-            List results = criteria.list();
-            if (results.size() > 1) {
-                // Should not have more than one root
-                throw new RollerException(
-                        "More than one root folder found for website "
-                        + website.getId());
-            } else if (results.size() == 1) {
-                // Return root
-                return ((FolderAssoc) results.get(0)).getFolder();
-            }
-            return null;
+            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
+            Criteria criteria = session.createCriteria(FolderData.class);
+            
+            criteria.add(Expression.eq("website", website));
+            criteria.add(Expression.isNull("parent"));
+            criteria.setMaxResults(1);
+            
+            return (FolderData) criteria.uniqueResult();
+            
         } catch (HibernateException e) {
             throw new RollerException(e);
         }
@@ -408,108 +355,32 @@
         
     }
     
+    
     /**
      * @see org.apache.roller.model.BookmarkManager#isDuplicateFolderName(org.apache.roller.pojos.FolderData)
      */
     public boolean isDuplicateFolderName(FolderData folder) throws RollerException {
-        // ensure that no sibling folders share the same name
-        boolean isNewFolder = (folder.getId() == null);
-        FolderData parent =
-                isNewFolder ? (FolderData)folder.getNewParent() : folder.getParent();
         
+        // ensure that no sibling folders share the same name
+        FolderData parent = folder.getParent();
         if (null != parent) {
-            List sameNames;
-            try {
-                Session session = ((HibernatePersistenceStrategy) strategy).getSession();
-                Criteria criteria = session.createCriteria(FolderAssoc.class);
-                criteria.createAlias("folder", "f");
-                criteria.add(Expression.eq("f.name", folder.getName()));
-                criteria.add(Expression.eq("ancestorFolder", parent));
-                criteria.add(Expression.eq("relation", Assoc.PARENT));
-                sameNames = criteria.list();
-            } catch (HibernateException e) {
-                throw new RollerException(e);
-            }
-            // If we got some matches
-            if (sameNames.size() > 0) {
-                // if we're saving a new folder, any matches are dups
-                if (isNewFolder) return true;
-                // otherwise it's a dup it isn't the same one (one match with the same id).
-                if (!(sameNames.size() == 1 && folder.getId().equals(((FolderAssoc)sameNames.get(0)).getFolder().getId())))
+            // TODO: if folder.equals() worked right then we should be able
+            // to use parent.getFolders().contains(folder) instead of this loop
+            
+            FolderData sibling = null;
+            Iterator siblings = parent.getFolders().iterator();
+            while(siblings.hasNext()) {
+                sibling = (FolderData) siblings.next();
+                
+                if(folder.getName().equals(sibling.getName())) {
                     return true;
+                }
             }
         }
+        
         return false;
     }
     
-    /**
-     * @see org.apache.roller.model.BookmarkManager#getFolderParentAssoc(
-     * org.apache.roller.pojos.FolderData)
-     */
-    public Assoc getFolderParentAssoc(FolderData folder) throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
-            Criteria criteria = session.createCriteria(FolderAssoc.class);
-            criteria.add(Expression.eq("folder", folder));
-            criteria.add(Expression.eq("relation", Assoc.PARENT));
-            List parents = criteria.list();
-            if (parents.size() > 1) {
-                throw new RollerException("ERROR: more than one parent");
-            } else if (parents.size() == 1) {
-                return (Assoc) parents.get(0);
-            } else {
-                return null;
-            }
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
-    
-    /**
-     * @see org.apache.roller.model.BookmarkManager#getFolderChildAssocs(
-     * org.apache.roller.pojos.FolderData)
-     */
-    public List getFolderChildAssocs(FolderData folder) throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
-            Criteria criteria = session.createCriteria(FolderAssoc.class);
-            criteria.add(Expression.eq("ancestorFolder", folder));
-            criteria.add(Expression.eq("relation", Assoc.PARENT));
-            return criteria.list();
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
-    
-    /**
-     * @see org.apache.roller.model.BookmarkManager#getAllFolderDecscendentAssocs(
-     * org.apache.roller.pojos.FolderData)
-     */
-    public List getAllFolderDecscendentAssocs(FolderData folder) throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
-            Criteria criteria = session.createCriteria(FolderAssoc.class);
-            criteria.add(Expression.eq("ancestorFolder", folder));
-            return criteria.list();
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
-    
-    /**
-     * @see org.apache.roller.model.BookmarkManager#getFolderAncestorAssocs(
-     * org.apache.roller.pojos.FolderData)
-     */
-    public List getFolderAncestorAssocs(FolderData folder) throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
-            Criteria criteria = session.createCriteria(FolderAssoc.class);
-            criteria.add(Expression.eq("folder", folder));
-            return criteria.list();
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
     
     /**
      * @see org.apache.roller.model.BookmarkManager#isFolderInUse(org.apache.roller.pojos.FolderData)
@@ -538,18 +409,4 @@
         }
     }
     
-    public boolean isDescendentOf(FolderData child, FolderData ancestor)
-    throws RollerException {
-        boolean ret = false;
-        try {
-            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
-            Criteria criteria = session.createCriteria(FolderAssoc.class);
-            criteria.add(Expression.eq("folder", child));
-            criteria.add(Expression.eq("ancestorFolder", ancestor));
-            ret = criteria.list().size() > 0;
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-        return ret;
-    }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java Wed Nov 15 11:14:24 2006
@@ -21,7 +21,6 @@
 import java.io.StringBufferInputStream;
 import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -31,8 +30,6 @@
 import org.hibernate.Transaction;
 import org.hibernate.cfg.Configuration;
 import org.apache.roller.RollerException;
-import org.apache.roller.pojos.Assoc;
-import org.apache.roller.pojos.HierarchicalPersistentObject;
 import org.apache.roller.pojos.PersistentObject;
 import org.jdom.Attribute;
 import org.jdom.Document;
@@ -219,7 +216,14 @@
         
         Session session = getSession();
         try {
+            // first lets flush the current state to the db
+            log.info("Flushing Hibernate Session");
+            session.flush();
+            
+            // then commit the current transaction to finish it
+            log.info("Committing Hibernate Transaction");
             session.getTransaction().commit();
+            
         } catch(Throwable t) {
             // uh oh ... failed persisting, gotta release
             release();
@@ -370,171 +374,4 @@
         }
     }
     
-    
-    /**
-     * Store hierarchical object.
-     *
-     * NOTE: if the object has proper cascade setting then is all this necessary?
-     */
-    public void store(HierarchicalPersistentObject obj)
-            throws HibernateException, RollerException {
-        
-        if(obj == null) {
-            throw new HibernateException("Cannot save null object");
-        }
-        
-        log.debug("Storing hierarchical object "+obj);
-        
-        Session session = getSession();
-        
-        HierarchicalPersistentObject mNewParent = obj.getNewParent();
-        boolean fresh = (obj.getId() == null || "".equals(obj.getId()));
-        
-        if (fresh) {
-            // Object has never been written to database, so save it.
-            // This makes obj into a persistent instance.
-            session.save(obj);
-        }
-        
-        if(!session.contains(obj)) {
-            
-            // Object has been written to database, but instance passed in
-            // is not a persistent instance, so must be loaded into session.
-            HierarchicalPersistentObject vo =
-                    (HierarchicalPersistentObject)session.load(obj.getClass(),obj.getId());
-            vo.setData(obj);
-            obj = vo;
-        }
-        
-        if (fresh) {
-            // Every fresh cat needs a parent assoc
-            Assoc parentAssoc = obj.createAssoc(
-                    obj, mNewParent, Assoc.PARENT);
-            this.store(parentAssoc);
-        } else if (null != mNewParent) {
-            // New parent must be added to parentAssoc
-            Assoc parentAssoc = obj.getParentAssoc();
-            if(parentAssoc == null)
-                log.error("parent assoc is null");
-            parentAssoc.setAncestor(mNewParent);
-            this.store(parentAssoc);
-        }
-        
-        // Clear out existing grandparent associations
-        Iterator ancestors = obj.getAncestorAssocs().iterator();
-        while (ancestors.hasNext()) {
-            Assoc assoc = (Assoc)ancestors.next();
-            if (assoc.getRelation().equals(Assoc.GRANDPARENT)) {
-                this.remove(assoc);
-            }
-        }
-        
-        // Walk parent assocations, creating new grandparent associations
-        int count = 0;
-        Assoc currentAssoc = obj.getParentAssoc();
-        while (null != currentAssoc.getAncestor()) {
-            if (count > 0) {
-                Assoc assoc = obj.createAssoc(obj,
-                        currentAssoc.getAncestor(),
-                        Assoc.GRANDPARENT);
-                this.store(assoc);
-            }
-            currentAssoc = currentAssoc.getAncestor().getParentAssoc();
-            count++;
-        }
-        
-        Iterator children = obj.getChildAssocs().iterator();
-        while (children.hasNext()) {
-            Assoc assoc = (Assoc) children.next();
-            
-            // resetting parent will cause reset of ancestors links
-            assoc.getObject().setParent(obj);
-            
-            // recursively...
-            this.store(assoc.getObject());
-        }
-        
-        // Clear new parent now that new parent has been saved
-        mNewParent = null;
-    }
-    
-    
-    /**
-     * Store assoc.
-     */
-    public void store(Assoc assoc) throws HibernateException {
-        
-        if(assoc == null) {
-            throw new HibernateException("Cannot save null object");
-        }
-        
-        getSession().saveOrUpdate(assoc);
-    }
-    
-    
-    /**
-     * Remove hierarchical object.
-     *
-     * NOTE: if the object has proper cascade setting then is all this necessary?
-     */
-    public void remove(HierarchicalPersistentObject obj) throws RollerException {
-        
-        if(obj == null) {
-            throw new RollerException("Cannot remove null object");
-        }
-        
-        log.debug("Removing hierarchical object "+obj.getId());
-        
-        // loop to remove all descendents and associations
-        List toRemove = new LinkedList();
-        List assocs = obj.getAllDescendentAssocs();
-        for (int i=assocs.size()-1; i>=0; i--) {
-            Assoc assoc = (Assoc)assocs.get(i);
-            HierarchicalPersistentObject hpo = assoc.getObject();
-            
-            // remove my descendent's parent and grandparent associations
-            Iterator ancestors = hpo.getAncestorAssocs().iterator();
-            while (ancestors.hasNext()) {
-                Assoc dassoc = (Assoc)ancestors.next();
-                this.remove(dassoc);
-            }
-            
-            // remove decendent association and descendents
-            //assoc.remove();
-            toRemove.add(hpo);
-        }
-        Iterator removeIterator = toRemove.iterator();
-        while (removeIterator.hasNext()) {
-            PersistentObject po = (PersistentObject) removeIterator.next();
-            getSession().delete(po);
-        }
-        
-        // loop to remove my own parent and grandparent associations
-        Iterator ancestors = obj.getAncestorAssocs().iterator();
-        while (ancestors.hasNext()) {
-            Assoc assoc = (Assoc)ancestors.next();
-            this.remove(assoc);
-        }
-        
-        getSession().delete(obj);
-    }
-    
-    
-    /**
-     * Remove assoc.
-     */
-    public void remove(Assoc assoc) throws HibernateException {
-        
-        if(assoc == null) {
-            throw new HibernateException("Cannot save null object");
-        }
-        
-        getSession().delete(assoc);
-    }
-    
 }
-
-
-
-
-

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java Wed Nov 15 11:14:24 2006
@@ -15,7 +15,7 @@
  * copyright in this work, please see the NOTICE file in the top level
  * directory of this distribution.
  */
-/* Created on Jun 16, 2004 */
+
 package org.apache.roller.business.hibernate;
 
 import java.util.ArrayList;
@@ -60,6 +60,7 @@
 import org.apache.roller.pojos.WebsiteData;
 import org.hibernate.Query;
 
+
 /**
  * Hibernate implementation of the UserManager.
  */
@@ -193,16 +194,16 @@
             this.strategy.remove(rootFolder);
             
             // Still cannot get all Bookmarks cleared!
-            Iterator allFolders = bmgr.getAllFolders(website).iterator();
-            while (allFolders.hasNext()) {
-                FolderData aFolder = (FolderData)allFolders.next();
-                bmgr.removeFolderContents(aFolder);
-                this.strategy.remove(aFolder);
-            }
+//            Iterator allFolders = bmgr.getAllFolders(website).iterator();
+//            while (allFolders.hasNext()) {
+//                FolderData aFolder = (FolderData)allFolders.next();
+//                bmgr.removeFolderContents(aFolder);
+//                this.strategy.remove(aFolder);
+//            }
         }
         
         // remove categories
-        WeblogCategoryData rootCat = wmgr.getRootWeblogCategory(website);
+        WeblogCategoryData rootCat = website.getDefaultCategory();
         if (null != rootCat) {
             this.strategy.remove(rootCat);
         }
@@ -287,7 +288,7 @@
         perms.setPermissionMask(PermissionsData.ADMIN);
         this.strategy.store(perms);
         
-        // add default categories
+        // add default category
         WeblogCategoryData rootCat = new WeblogCategoryData(
                 null,      // id
                 newWeblog, // newWeblog
@@ -299,7 +300,7 @@
         
         String cats = RollerConfig.getProperty("newuser.categories");
         WeblogCategoryData firstCat = rootCat;
-        if (cats != null) {
+        if (cats != null && cats.trim().length() > 0) {
             String[] splitcats = cats.split(",");
             for (int i=0; i<splitcats.length; i++) {
                 WeblogCategoryData c = new WeblogCategoryData(
@@ -313,6 +314,7 @@
                 this.strategy.store(c);
             }
         }
+        
         // Use first category as default for Blogger API
         newWeblog.setBloggerCategory(firstCat);
         

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java Wed Nov 15 11:14:24 2006
@@ -39,7 +39,6 @@
 import org.apache.roller.RollerException;
 import org.apache.roller.business.RollerFactory;
 import org.apache.roller.business.WeblogManager;
-import org.apache.roller.pojos.Assoc;
 import org.apache.roller.pojos.CommentData;
 import org.apache.roller.pojos.HitCountData;
 import org.apache.roller.pojos.RefererData;
@@ -47,7 +46,6 @@
 import org.apache.roller.pojos.TagStat;
 import org.apache.roller.pojos.TagStatComparator;
 import org.apache.roller.pojos.UserData;
-import org.apache.roller.pojos.WeblogCategoryAssoc;
 import org.apache.roller.pojos.WeblogCategoryData;
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WeblogEntryTagData;
@@ -94,7 +92,7 @@
     
     public void saveWeblogCategory(WeblogCategoryData cat) throws RollerException {
         
-        if(this.isDuplicateWeblogCategoryName(cat)) {
+        if(cat.getId() == null && this.isDuplicateWeblogCategoryName(cat)) {
             throw new RollerException("Duplicate category name, cannot save category");
         }
         
@@ -317,24 +315,23 @@
         
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-            criteria.createAlias("category","c");
-            
-            criteria.add(Expression.eq("c.website", website));
-            criteria.add(Expression.isNull("ancestorCategory"));
-            criteria.add(Expression.eq("relation", WeblogCategoryAssoc.PARENT));
+            Criteria criteria = session.createCriteria(WeblogCategoryData.class);
             
+            criteria.add(Expression.eq("website", website));
+            criteria.add(Expression.isNull("parent"));
             criteria.setMaxResults(1);
             
-            List list = criteria.list();
-            return ((WeblogCategoryAssoc)list.get(0)).getCategory();
+            return (WeblogCategoryData) criteria.uniqueResult();
+            
         } catch (HibernateException e) {
             throw new RollerException(e);
         }
     }
     
+    // TODO: need unit tests for this function
     public List getWeblogCategories(WebsiteData website, boolean includeRoot)
     throws RollerException {
+        
         if (website == null)
             throw new RollerException("website is null");
         
@@ -342,24 +339,19 @@
         
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-            criteria.createAlias("category", "c");
-            criteria.add(Expression.eq("c.website", website));
-            criteria.add(Expression.isNotNull("ancestorCategory"));
-            criteria.add(Expression.eq("relation", "PARENT"));
-            Iterator assocs = criteria.list().iterator();
-            List cats = new ArrayList();
-            while (assocs.hasNext()) {
-                WeblogCategoryAssoc assoc = (WeblogCategoryAssoc) assocs.next();
-                cats.add(assoc.getCategory());
-            }
-            return cats;
+            Criteria criteria = session.createCriteria(WeblogCategoryData.class);
+            criteria.add(Expression.eq("website", website));
+            criteria.add(Expression.isNotNull("parent"));
+            return criteria.list();
         } catch (HibernateException e) {
             throw new RollerException(e);
         }
     }
     
+    
+    // TODO: need unit tests for this function
     public List getWeblogCategories(WebsiteData website) throws RollerException {
+        
         if (website == null)
             throw new RollerException("website is null");
         
@@ -373,6 +365,7 @@
         }
     }
     
+    
     public List getWeblogEntries(
             WebsiteData website,
             UserData    user,
@@ -587,43 +580,37 @@
         
     public List getWeblogEntries(WeblogCategoryData cat, boolean subcats)
     throws RollerException {
+        
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             List entries = new LinkedList();
             
-            if (subcats) {
-                // Get entries in subcategories
-                Criteria assocsQuery =
-                        session.createCriteria(WeblogCategoryAssoc.class);
-                assocsQuery.add(Expression.eq("ancestorCategory", cat));
-                Iterator assocs = assocsQuery.list().iterator();
-                while (assocs.hasNext()) {
-                    WeblogCategoryAssoc assoc = (WeblogCategoryAssoc)assocs.next();
-                    Criteria entriesQuery =
-                            session.createCriteria(WeblogEntryData.class);
-                    entriesQuery.add(
-                            Expression.eq("category", assoc.getCategory()));
-                    Iterator entryIter = entriesQuery.list().iterator();
-                    while (entryIter.hasNext()) {
-                        WeblogEntryData entry = (WeblogEntryData)entryIter.next();
-                        entries.add(entry);
-                    }
-                }
-            }
-            
             // Get entries in category
-            Criteria entriesQuery =
-                    session.createCriteria(WeblogEntryData.class);
+            Criteria entriesQuery = session.createCriteria(WeblogEntryData.class);
             entriesQuery.add(Expression.eq("category", cat));
             Iterator entryIter = entriesQuery.list().iterator();
             while (entryIter.hasNext()) {
                 WeblogEntryData entry = (WeblogEntryData)entryIter.next();
                 entries.add(entry);
             }
+            
+            if (subcats) {
+                // recursive call for child categories
+                WeblogCategoryData childCat = null;
+                Iterator childCats = cat.getWeblogCategories().iterator();
+                while(childCats.hasNext()) {
+                    childCat = (WeblogCategoryData) childCats.next();
+                    
+                    entries.addAll(childCat.retrieveWeblogEntries(subcats));
+                }
+            }
+            
             return entries;
+            
         } catch (HibernateException e) {
             throw new RollerException(e);
         }
+        
     }
         
     public String createAnchor(WeblogEntryData entry) throws RollerException {
@@ -657,34 +644,32 @@
         }
     }
     
+    
+    // TODO: need to fix this method and provide unit test case
     public boolean isDuplicateWeblogCategoryName(WeblogCategoryData cat)
-    throws RollerException {
-        // ensure that no sibling categories share the same name
-        WeblogCategoryData parent =
-                null == cat.getId() ? (WeblogCategoryData)cat.getNewParent() : cat.getParent();
+            throws RollerException {
         
-        if (null != parent) // don't worry about root
-        {
-            List sameNames;
-            try {
-                Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-                Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-                criteria.createAlias("category", "c");
-                criteria.add(Expression.ne("c.id", cat.getId()));
-                criteria.add(Expression.eq("c.name", cat.getName()));
-                criteria.add(Expression.eq("ancestorCategory", parent));
-                criteria.add(Expression.eq("relation", Assoc.PARENT));
-                sameNames = criteria.list();
-            } catch (HibernateException e) {
-                throw new RollerException(e);
-            }
-            if (sameNames.size() > 0) {
-                return true;
+        // ensure that no sibling categories share the same name
+        WeblogCategoryData parent = cat.getParent();
+        if (null != parent) {
+            // TODO: if cat.equals() worked right then we should be able
+            // to use parent.getWeblogCategories().contains(cat) instead of this loop
+            
+            WeblogCategoryData sibling = null;
+            Iterator siblings = parent.getWeblogCategories().iterator();
+            while(siblings.hasNext()) {
+                sibling = (WeblogCategoryData) siblings.next();
+                
+                if(cat.getName().equals(sibling.getName())) {
+                    return true;
+                }
             }
         }
+        
         return false;
     }
     
+    
     public boolean isWeblogCategoryInUse(WeblogCategoryData cat)
     throws RollerException {
         try {
@@ -720,78 +705,6 @@
         }
     }
     
-    public boolean isDescendentOf(
-            WeblogCategoryData child, WeblogCategoryData ancestor)
-            throws RollerException {
-        boolean ret = false;
-        try {
-            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-            criteria.add(Expression.eq("category", child));
-            criteria.add(Expression.eq("ancestorCategory", ancestor));
-            ret = criteria.list().size() > 0;
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-        return ret;
-    }
-    
-    public Assoc getWeblogCategoryParentAssoc(WeblogCategoryData cat)
-    throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-            criteria.add(Expression.eq("category", cat));
-            criteria.add(Expression.eq("relation", Assoc.PARENT));
-            List parents = criteria.list();
-            if (parents.size() > 1) {
-                throw new RollerException("ERROR: more than one parent");
-            } else if (parents.size() == 1) {
-                return (Assoc) parents.get(0);
-            } else {
-                return null;
-            }
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
-    
-    public List getWeblogCategoryChildAssocs(WeblogCategoryData cat)
-    throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-            criteria.add(Expression.eq("ancestorCategory", cat));
-            criteria.add(Expression.eq("relation", Assoc.PARENT));
-            return criteria.list();
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
-    
-    public List getAllWeblogCategoryDecscendentAssocs(WeblogCategoryData cat)
-    throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-            criteria.add(Expression.eq("ancestorCategory", cat));
-            return criteria.list();
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
-    
-    public List getWeblogCategoryAncestorAssocs(WeblogCategoryData cat)
-    throws RollerException {
-        try {
-            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
-            criteria.add(Expression.eq("category", cat));
-            return criteria.list();
-        } catch (HibernateException e) {
-            throw new RollerException(e);
-        }
-    }
                 
     public List getComments(
             WebsiteData     website,
@@ -993,16 +906,6 @@
     public WeblogCategoryData getWeblogCategoryByPath(
             WebsiteData website, String categoryPath) throws RollerException {
         return getWeblogCategoryByPath(website, null, categoryPath);
-    }
-    
-    public String getPath(WeblogCategoryData category) throws RollerException {
-        if (null == category.getParent()) {
-            return "/";
-        } else {
-            String parentPath = getPath(category.getParent());
-            parentPath = "/".equals(parentPath) ? "" : parentPath;
-            return parentPath + "/" + category.getName();
-        }
     }
     
     public WeblogCategoryData getWeblogCategoryByPath(

Added: incubator/roller/trunk/src/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java?view=auto&rev=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java Wed Nov 15 11:14:24 2006
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.business.hibernate;
+
+import org.hibernate.FlushMode;
+import org.hibernate.SessionFactory;
+import org.hibernate.classic.Session;
+import org.hibernate.context.ThreadLocalSessionContext;
+import org.hibernate.engine.SessionFactoryImplementor;
+
+
+/**
+ * This is a special Hibernate SessionContext which was taken from the Hibernate forums so that we can use it
+ * to provide a way to commit our transactions while keeping the Session open for further use.  Details here ...
+ *
+ * http://forum.hibernate.org/viewtopic.php?t=958752
+ *
+ * ... which was found from a reference here ...
+ *
+ * http://forum.hibernate.org/viewtopic.php?t=957056
+ *
+ * Extends {@link ThreadLocalSessionContext} to allow for long conversations. It achieves this by setting every
+ * <code>Session</code> it produces to <code>FlushMode.NEVER</code> so that it won't flush unless explicitly asked
+ * to, and by preventing the session from auto-closing or unbinding from the thread after a <code>Transaction</code>
+ * commit. Note that this means the application code must do these functions manually as needed!
+ */
+public class ThreadLocalSessionContextNoAutoClose extends ThreadLocalSessionContext {
+    
+    /**
+     * Create a new instance.
+     *
+     * @param factory The <code>SessionFactoryImplementor</code> required by the super constructor.
+     */
+    public ThreadLocalSessionContextNoAutoClose(SessionFactoryImplementor factory) {
+        super(factory);
+    }
+    
+    
+    /**
+     * Returns <code>false</code> to prevent auto closing.
+     *
+     * @return <code>false</code> to prevent auto closing.
+     */
+    protected boolean isAutoCloseEnabled() {
+        return false;
+    }
+    
+    
+    /**
+     * Returns <code>false</code> to prevent auto flushing.
+     *
+     * @return <code>false</code> to prevent auto flushing.
+     */
+    protected boolean isAutoFlushEnabled() {
+        return false;
+    }
+    
+    
+    /**
+     * Uses <code>super.buildOrObtainSession()</code>, then sets the resulting <code>Session</code>'s flush mode
+     * to <code>FlushMode.NEVER</code> to prevent auto-flushing.
+     *
+     * @return A session configured with <code>FlushMode.NEVER</code>.
+     */
+    protected Session buildOrObtainSession() {
+        Session s = super.buildOrObtainSession();
+        s.setFlushMode(FlushMode.NEVER);
+        return s;
+    }
+    
+    
+    /**
+     * Returns an instance of <code>CleanupSynch</code> which prevents auto closing and unbinding.
+     *
+     * @return A <code>CleanupSynch</code> which prevents auto closing and unbinding.
+     */
+    protected CleanupSynch buildCleanupSynch() {
+        return new NoCleanupSynch(factory);
+    }
+    
+    
+    /**
+     * A simple extension of <code>CleanupSynch</code> that prevents any cleanup from happening. No session closing or
+     * unbinding.
+     */
+    private static class NoCleanupSynch extends ThreadLocalSessionContext.CleanupSynch {
+        
+        /**
+         * Creates a new instance based on the given factory.
+         *
+         * @param factory The required <code>SessionFactory</code> that is passed to the super constructor.
+         */
+        public NoCleanupSynch(SessionFactory factory) {
+            super(factory);
+        }
+        
+        /**
+         * Does nothing, thus helping to prevent session closing and/or unbinding.
+         */
+        public void beforeCompletion() {
+            // do nothing
+        }
+        
+        /**
+         * Does nothing, thus helping to prevent session closing and/or unbinding.
+         *
+         * @param i
+         */
+        public void afterCompletion(int i) {
+            // do nothing
+        }
+    }
+    
+}

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java Wed Nov 15 11:14:24 2006
@@ -28,7 +28,7 @@
  *
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  * @ejb:bean name="AutoPingData"
- * @hibernate.class lazy="false" table="autoping"
+ * @hibernate.class lazy="true" table="autoping"
  * @hibernate.cache usage="read-write"
  */
 public class AutoPingData extends PersistentObject implements Serializable {

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java Wed Nov 15 11:14:24 2006
@@ -1,20 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
 package org.apache.roller.pojos;
 
 import org.apache.roller.RollerException;
@@ -24,6 +25,7 @@
 
 import java.io.Serializable;
 
+
 /**
  * <p>Represents a single URL in a user's favorite web-bookmarks collection.
  * Don't construct one of these yourself, instead use the create method in 
@@ -34,7 +36,7 @@
  * @struts.form include-all="true"
  *    extends="org.apache.struts.validator.ValidatorForm"
  * 
- * @hibernate.class lazy="false" table="bookmark"
+ * @hibernate.class lazy="true" table="bookmark"
  * @hibernate.cache usage="read-write"
  */
 public class BookmarkData extends PersistentObject

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java Wed Nov 15 11:14:24 2006
@@ -27,7 +27,7 @@
  * @ejb:bean name="CommentData"
  * @struts.form include-all="true"
  *
- * @hibernate.class lazy="false" table="roller_comment"
+ * @hibernate.class lazy="true" table="roller_comment"
  * @hibernate.cache usage="read-write"
  */
 public class CommentData extends org.apache.roller.pojos.PersistentObject

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java Wed Nov 15 11:14:24 2006
@@ -19,7 +19,7 @@
 /**
  * @author David M Johnson
  * @ejb:bean name="EntryAttribute"
- * @hibernate.class lazy="false" table="entryattribute"
+ * @hibernate.class lazy="true" table="entryattribute"
  * @hibernate.cache usage="read-write"
  */
 public class EntryAttributeData extends PersistentObject implements java.lang.Comparable

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java Wed Nov 15 11:14:24 2006
@@ -19,8 +19,8 @@
 package org.apache.roller.pojos;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -40,22 +40,23 @@
  *    extends="org.apache.struts.validator.ValidatorForm"
  * @ejb:bean name="FolderData"
  *
- * @hibernate.class lazy="false" table="folder"
+ * @hibernate.class lazy="true" table="folder"
  * @hibernate.cache usage="read-write"
  */
-public class FolderData extends HierarchicalPersistentObject
+public class FolderData extends PersistentObject
         implements Serializable, Comparable {
     
     static final long serialVersionUID = -6272468884763861944L;
     
+    private String id = null;
+    private String name = null;
+    private String description = null;
+    private String path = null;
+    
+    private WebsiteData website = null;
+    private FolderData parentFolder = null;
+    private Set childFolders = new TreeSet();
     private Set bookmarks = new TreeSet();
-    private List folders = null;
-    private WebsiteData website;
-    
-    private String id;
-    private String name;
-    private String description;
-    private String path;
     
     
     /** For use by BookmarkManager implementations only. */
@@ -67,19 +68,22 @@
             String name,
             String desc,
             WebsiteData website) {
-        mNewParent = parent;
         this.name = name;
         this.description = desc;
         this.website = website;
+        this.parentFolder = parent;
     }
     
-    public void setData(org.apache.roller.pojos.PersistentObject otherData) {
-        mNewParent =       ((FolderData) otherData).mNewParent;
-        this.id =          ((FolderData) otherData).getId();
-        this.name =        ((FolderData) otherData).getName();
-        this.description = ((FolderData) otherData).getDescription();
-        this.website =     ((FolderData) otherData).getWebsite();
-        this.setBookmarks(((FolderData) otherData).getBookmarks());
+    public void setData(PersistentObject other) {
+        FolderData otherData = (FolderData) other;
+        
+        this.id = otherData.getId();
+        this.name = otherData.getName();
+        this.description = otherData.getDescription();
+        this.website = otherData.getWebsite();
+        this.parentFolder = otherData.getParent();
+        this.childFolders = otherData.getFolders();
+        this.setBookmarks(otherData.getBookmarks());
     }
     
     
@@ -166,8 +170,6 @@
     /**
      * @roller.wrapPojoMethod type="simple"
      *
-     * @ejb:persistent-field
-     *
      * @hibernate.id column="id"
      *     generator-class="uuid.hex" unsaved-value="null"
      */
@@ -175,11 +177,11 @@
         return this.id;
     }
     
-    /** @ejb:persistent-field */
     public void setId(String id) {
         this.id = id;
     }
     
+    
     /**
      * @roller.wrapPojoMethod type="simple"
      *
@@ -188,26 +190,22 @@
      * @struts.validator-var name="mask" value="${noslashes}"
      * @struts.validator-args arg0resource="folderForm.name"
      *
-     * @ejb:persistent-field
-     *
      * @hibernate.property column="name" non-null="true" unique="false"
      */
     public String getName() {
         return this.name;
     }
     
-    /** @ejb:persistent-field */
     public void setName(String name) {
         this.name = name;
     }
     
+    
     /**
      * Description
      *
      * @roller.wrapPojoMethod type="simple"
      *
-     * @ejb:persistent-field
-     *
      * @hibernate.property column="description" non-null="true" unique="false"
      */
     public String getDescription() {
@@ -219,7 +217,6 @@
         this.description = description;
     }
     
-    //---------------------------------------------------------- Relationships
     
     /**
      * Get path to this bookmark folder.
@@ -227,16 +224,22 @@
      * @roller.wrapPojoMethod type="simple"
      */
     public String getPath() throws RollerException {
-        if (mNewParent != null) {
-            throw new RollerException(
-                    "Folder has a new parent and must be saved before getPath() will work");
-        }
         
         if (null == path) {
-            path = RollerFactory.getRoller().getBookmarkManager().getPath(this);
+            if (getParent() == null) {
+                return "/";
+            } else {
+                String parentPath = getParent().getPath();
+                parentPath = "/".equals(parentPath) ? "" : parentPath;
+                return parentPath + "/" + this.name;
+            }
         }
+        
         return path;
     }
+    /** TODO: fix formbean generation so this is not needed. */
+    public void setPath(String string) {}
+    
     
     /**
      * @roller.wrapPojoMethod type="pojo"
@@ -254,54 +257,46 @@
         this.website = website;
     }
     
+    
     /**
      * Return parent category, or null if category is root of hierarchy.
      *
      * @roller.wrapPojoMethod type="pojo"
+     *
+     * @hibernate.many-to-one column="parentid" cascade="none" not-null="false"
      */
-    public FolderData getParent() throws RollerException {
-        if (mNewParent != null) {
-            // Category has new parent, so return that
-            return (FolderData)mNewParent;
-        } else if (getParentAssoc() != null) {
-            // Return parent found in database
-            return ((FolderAssoc)getParentAssoc()).getAncestorFolder();
-        } else {
-            return null;
-        }
+    public FolderData getParent() {
+        return this.parentFolder;
     }
     
     /** Set parent category, database will be updated when object is saved. */
-    public void setParent(HierarchicalPersistentObject parent) {
-        mNewParent = parent;
+    public void setParent(FolderData parent) {
+        this.parentFolder = parent;
     }
     
+    
     /**
      * Query to get child categories of this category.
      *
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.FolderData"
+     *
+     * @hibernate.set lazy="true" inverse="true" cascade="delete"
+     * @hibernate.collection-key column="parentid"
+     * @hibernate.collection-one-to-many class="org.apache.roller.pojos.FolderData"
      */
-    public List getFolders() throws RollerException {
-        if (folders == null) {
-            folders = new LinkedList();
-            List childAssocs = getChildAssocs();
-            Iterator childIter = childAssocs.iterator();
-            while (childIter.hasNext()) {
-                FolderAssoc assoc =
-                        (FolderAssoc) childIter.next();
-                folders.add(assoc.getFolder());
-            }
-        }
-        return folders;
+    public Set getFolders() {
+        return this.childFolders;
+    }
+    
+    /** Set parent category, database will be updated when object is saved. */
+    private void setFolders(Set folders) {
+        this.childFolders = folders;
     }
     
-    //------------------------------------------------------ Bookmark children
     
     /**
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.BookmarkData"
      *
-     * @ejb:persistent-field
-     *
      * @hibernate.set lazy="true" order-by="name" inverse="true" cascade="all-delete-orphan"
      * @hibernate.collection-key column="folderid"
      * @hibernate.collection-one-to-many class="org.apache.roller.pojos.BookmarkData"
@@ -315,6 +310,7 @@
         this.bookmarks = bookmarks;
     }
     
+    
     /** Store bookmark and add to folder */
     public void addBookmark(BookmarkData bookmark) throws RollerException {
         bookmark.setFolder(this);
@@ -326,6 +322,7 @@
         getBookmarks().remove(bookmark);
     }
     
+    
     /**
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.BookmarkData"
      *
@@ -341,25 +338,29 @@
      * subfolders of this folder to a single new folder.
      */
     public void moveContents(FolderData dest) throws RollerException {
-        Iterator entries = retrieveBookmarks(true).iterator();
-        while (entries.hasNext()) {
-            BookmarkData bookmark = (BookmarkData) entries.next();
-            
-            // just add bookmarks to new folder
-            // this breaks the old folder/bkmrk relationship
-            // so it's not necessary to explicitly remove
-            dest.addBookmark(bookmark);
-        }
+        
+        BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
+        bmgr.moveFolderContents(this, dest);
     }
     
-    //------------------------------------------------------------------------
     
     /**
      * @roller.wrapPojoMethod type="simple"
      */
-    public boolean descendentOf(FolderData ancestor)
-    throws RollerException {
-        return RollerFactory.getRoller().getBookmarkManager().isDescendentOf(this, ancestor);
+    public boolean descendentOf(FolderData ancestor) {
+        
+        // if this is root then we can't be a descendent
+        if(getParent() == null) {
+            return false;
+        } else {
+            // if ancestor is our parent then we are a descendent
+            if(getParent().equals(ancestor)) {
+                return true;
+            } else {
+                // see if our parent is a descendent
+                return getParent().descendentOf(ancestor);
+            }
+        }
     }
     
     
@@ -373,88 +374,7 @@
             throw new RuntimeException(e);
         }
     }
-    
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAssocClass()
-     */
-    public Class getAssocClass() {
-        return FolderAssoc.class;
-    }
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#getObjectPropertyName()
-     *
-     * @roller.wrapPojoMethod type="simple"
-     */
-    public String getObjectPropertyName() {
-        return "folder";
-    }
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAncestorPropertyName()
-     *
-     * @roller.wrapPojoMethod type="simple"
-     */
-    public String getAncestorPropertyName() {
-        return "ancestorFolder";
-    }
-    
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#createAssoc(
-     *    org.apache.roller.pojos.HierarchicalPersistentObject,
-     *    org.apache.roller.pojos.HierarchicalPersistentObject, java.lang.String)
-     */
-    public Assoc createAssoc(
-            HierarchicalPersistentObject object,
-            HierarchicalPersistentObject associatedObject,
-            String relation) throws RollerException {
-        return new FolderAssoc(
-                null,
-                (FolderData)object,
-                (FolderData)associatedObject,
-                relation);
-    }
-    
-    
-    /** TODO: fix Struts form generation template so this is not needed. */
-    public void setAssocClassName(String dummy) {};
-    /** TODO: fix Struts form generation template so this is not needed. */
-    public void setObjectPropertyName(String dummy) {};
-    /** TODO: fix Struts form generation template so this is not needed. */
-    public void setAncestorPropertyName(String dummy) {};
-    /** TODO: fix formbean generation so this is not needed. */
-    public void setPath(String string) {}
     /** TODO: fix formbean generation so this is not needed. */
     public void setInUse(boolean flag) {}
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#getParentAssoc()
-     */
-    public Assoc getParentAssoc() throws RollerException {
-        return RollerFactory.getRoller().getBookmarkManager().getFolderParentAssoc(this);
-    }
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#getChildAssocs()
-     */
-    public List getChildAssocs() throws RollerException {
-        return RollerFactory.getRoller().getBookmarkManager().getFolderChildAssocs(this);
-    }
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAllDescendentAssocs()
-     */
-    public List getAllDescendentAssocs() throws RollerException {
-        return RollerFactory.getRoller().getBookmarkManager().getAllFolderDecscendentAssocs(this);
-    }
-    
-    /**
-     * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAncestorAssocs()
-     */
-    public List getAncestorAssocs() throws RollerException {
-        return RollerFactory.getRoller().getBookmarkManager().getFolderAncestorAssocs(this);
-    }
     
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java Wed Nov 15 11:14:24 2006
@@ -22,7 +22,7 @@
  * Records change that a user has made to an object.
  * @ejb:bean name="ObjectAuditData"
  * @struts.form include-all="true"
- * @hibernate.class lazy="false" table="roller_audit_log"  
+ * @hibernate.class lazy="true" table="roller_audit_log"  
  *
  * @author Dave Johnson
  */

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java Wed Nov 15 11:14:24 2006
@@ -21,7 +21,7 @@
  *
  * @ejb:bean name="PermissionsData"
  * @struts.form include-all="true"
- * @hibernate.class lazy="false" table="roller_user_permissions"
+ * @hibernate.class lazy="true" table="roller_user_permissions"
  * @hibernate.cache usage="read-write"
  *
  * @author Dave Johnson

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java Wed Nov 15 11:14:24 2006
@@ -29,7 +29,7 @@
  *
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  * @ejb:bean name="AutoPingData"
- * @hibernate.class lazy="false" table="pingcategory"
+ * @hibernate.class lazy="true" table="pingcategory"
  * @hibernate.cache usage="read-write"
  */
 public class PingCategoryRestrictionData extends PersistentObject implements Serializable {

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java Wed Nov 15 11:14:24 2006
@@ -28,7 +28,7 @@
  *
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  * @ejb:bean name="PingQueueEntryData"
- * @hibernate.class lazy="false" table="pingqueueentry"
+ * @hibernate.class lazy="true" table="pingqueueentry"
  * @hibernate.cache usage="read-write"
  */
 public class PingQueueEntryData extends PersistentObject implements Serializable {

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java Wed Nov 15 11:14:24 2006
@@ -30,7 +30,7 @@
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  * @ejb:bean name="PingTargetData"
  * @struts.form include-all="true"
- * @hibernate.class lazy="false" table="pingtarget"
+ * @hibernate.class lazy="true" table="pingtarget"
  * @hibernate.cache usage="read-write"
  */
 public class PingTargetData extends PersistentObject implements Serializable {

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java Wed Nov 15 11:14:24 2006
@@ -29,7 +29,7 @@
  *
  * @ejb:bean name="RefererData"
  * @struts.form include-all="true"
- * @hibernate.class lazy="false" table="referer"
+ * @hibernate.class lazy="true" table="referer"
  * @hibernate.cache usage="read-write"
  */
 public class RefererData extends PersistentObject

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java Wed Nov 15 11:14:24 2006
@@ -25,7 +25,7 @@
  *
  * @ejb:bean name="RoleData"
  * @struts.form include-all="true"
- * @hibernate.class lazy="false" table="userrole"
+ * @hibernate.class lazy="true" table="userrole"
  * @hibernate.cache usage="read-write"
  */
 public class RoleData

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java Wed Nov 15 11:14:24 2006
@@ -39,7 +39,7 @@
  *
  * @ejb:bean name="RollerConfigData"
  * @struts.form include-all="true"
- * @hibernate.class lazy="false" table="rollerconfig"
+ * @hibernate.class lazy="true" table="rollerconfig"
  */
 public class RollerConfigData
     extends org.apache.roller.pojos.PersistentObject

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java Wed Nov 15 11:14:24 2006
@@ -30,7 +30,7 @@
  * @author Allen Gilliland
  *
  * @ejb:bean name="RollerPropertyData"
- * @hibernate.class lazy="false" table="roller_properties"
+ * @hibernate.class lazy="true" table="roller_properties"
  * @hibernate.cache usage="read-write"
  */
 public class RollerPropertyData 

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java Wed Nov 15 11:14:24 2006
@@ -27,7 +27,7 @@
  * Represents locking information about a specific RollerTask.
  *
  * @ejb:bean name="TaskLockData"
- * @hibernate.class lazy="false" table="roller_tasklock"
+ * @hibernate.class lazy="true" table="roller_tasklock"
  * @hibernate.cache usage="read-write"
  */
 public class TaskLockData extends PersistentObject implements Serializable {

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/UserData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/UserData.java?view=diff&rev=475368&r1=475367&r2=475368
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/UserData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/UserData.java Wed Nov 15 11:14:24 2006
@@ -39,7 +39,7 @@
  *
  * @ejb:bean name="UserData"
  * @struts.form include-all="true"
- * @hibernate.class lazy="false" table="rolleruser"
+ * @hibernate.class lazy="true" table="rolleruser"
  * @hibernate.cache usage="read-write"
  */
 public class UserData
@@ -404,7 +404,7 @@
     
     
     /**
-     * @hibernate.set lazy="false" inverse="true" cascade="all-delete-orphan"
+     * @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan"
      * @hibernate.collection-key column="userid"
      * @hibernate.collection-one-to-many class="org.apache.roller.pojos.RoleData"
      */