Code example for Session

Methods: setFlushModecreateQuery

0
     * @return a forward-only {@link ScrollableResults} 
     */ 
    private ScrollableResults getForwardOnlyCursor(Filter filter) {
        if (session == null) {
            session = sessionFactory.openSession();
            session.setFlushMode(FlushMode.MANUAL);
        } 
         
        String queryString = " from ProfileResourceNode profileResourceNode ";
 
         
//        String queryString = " from FormatIdentification fis "  
//            + " inner join fetch fis.node profileResourceNode "  
//            + " left join profileResourceNode.systemMessages sm "  
//            + " inner join fetch fis.format format"; 
 
        Query query;
        if (filter != null && filter.isEnabled()) { 
            HqlFilterParser filterParser = new HqlFilterParser();
            query = filterParser.parse(filter, session, queryString);
        } else { 
            query = session.createQuery(queryString);
        } 
         
        return query.setFetchSize(fetchSize).scroll(ScrollMode.FORWARD_ONLY);
    } 
 
Connect your IDE to all the code out there  Get Codota for Java