Hibernate中的order by子句

一、概述

二、order by子句使用


public void testOrderByClause(){
           String hql= " from Country as country order by country.ccode" ;
           Session session=CustomSessionFactory. getSession();
           Query query=session.createQuery(hql);
           List list=query.list();
            for (Country country:list){
                System. out .println( "编号:" +country.getCcode()+ "  名称:" +country.getCname());
           }
           CustomSessionFactory. closeSession();
     }


你可能感兴趣的:(Java:Hibernate)