hql根據參數傳遞的值模糊查詢

@Override
public List<Currency> getCurrency(String code,String desc1,int offset, int size) {
// TODO Auto-generated method stub
List<Currency> list=null;
String hql="from Currency where code like :code and desc1 like :desc1";
Query query = this.getSession().createQuery(hql).setString("code", "%"+code+"%").setString("desc1", "%"+desc1+"%").setFirstResult(offset).setMaxResults(size);
list = query.list();
return list;
}

posted @ 2015-01-07 11:41  rong.peimiao  阅读(147)  评论(0编辑  收藏  举报