protected long __getPageHibernateId ( int pageID ) { long hibernateID = - 1 ; // first look in the id mapping cache if ( idMapPages . containsKey ( pageID ) ) { return idMapPages . get ( pageID ) ; } // The id was not found in the id mapping cache. // It may not be in the cahe or may not exist at all. Session session = this . __getHibernateSession ( ) ; session . beginTransaction ( ) ; Object retObjectPage = session . createQuery ( "select page.id from Page as page where page.pageId = :pageId" ) . setParameter ( "pageId" , pageID , IntegerType . INSTANCE ) . uniqueResult ( ) ; session . getTransaction ( ) . commit ( ) ; if ( retObjectPage != null ) { hibernateID = ( Long ) retObjectPage ; // add it to the cache idMapPages . put ( pageID , hibernateID ) ; return hibernateID ; } return hibernateID ; }
Get the hibernate ID to a given pageID of a page . We need different methods for pages and categories here as a page and a category can have the same ID .