protected Set < Integer > __getCategories ( ) { // TODO this should be replaced with the buffered category iterator, as it might produce an HeapSpace Overflow, if there are too many categories. Session session = this . __getHibernateSession ( ) ; session . beginTransaction ( ) ; List < Integer > idList = session . createQuery ( "select cat.pageId from Category as cat" , Integer . class ) . list ( ) ; Set < Integer > categorySet = new HashSet < Integer > ( idList ) ; session . getTransaction ( ) . commit ( ) ; return categorySet ; }
Protected method that is much faster than the public version but exposes too much implementation details . Get a set with all category pageIDs . Returning all category objects is much too expensive .