Hibinment 分页查询

 @Test
    // 分页 的方法
    public  void  aVoid(){
        //String hql="from Dept";
        String hql="from Emp";
        Query query = session.createQuery(hql);
        int pageIndex=2;
        int pageSize=3;
        query.setFirstResult((pageIndex-1)*pageSize);
        query.setMaxResults(pageSize);
        List list = query.list();
        for (Emp item:list
             ) {
            System.out.println(item.getEname());
        }
    }





    

        
        oracle.jdbc.driver.OracleDriver
        jdbc:oracle:thin:@localhost:1521:orcl
        scott
        a123456a

        
        1

        
        org.hibernate.dialect.Oracle10gDialect

        
        
        thread


        
        true

        true

        
        update

        
        

        

        
        

        
        

        
        
    




你可能感兴趣的:(Hibinment 分页查询)