日期:2014-05-20 浏览次数:20751 次
String sql = " select wk.a1 ,wk.a2 , {ex.*} from " + " (select distinct a1,a2 from A ) as wk join mms_cell {ex} on {ex}.a1= wk.a1 " + " order by wk.a1,wk.a2,{ex}.mydate"; Query query = getSession().createSQLQuery(sql). addEntity("ex",User.class); List<Object[]> list = query.list();
Query query = getSession().createSQLQuery(sql).addScalar("a1",Hibernate.STRING).addScalar("a2",Hibernate.STRING). addEntity("ex",User.class);