我想按长度排序我的条款,相当于:
SELECT term FROM <table_name> where term like '%now%' order by length(term ) asc;
处于休眠状态。
目前这是我的标准代码:
Criteria criteria = session.createCriteria(myClass.class);
criteria.setProjection(Projections.distinct(Projections.property("term")));
criteria.add(Restrictions.ilike("term", "%xyz%"));
criteria.addOrder(Order.asc("term"));
criteria.setMaxResults(10);
List<String> list = criteria.list();
干杯