首页 > 代码库 > hql根據參數傳遞的值模糊查詢

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;
}

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