Hebernate模糊查询的问题!!
public List findByCCom(Object CCom) {
try {
String queryString = "from TabCou as model where model._CCOM like ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, "%"+CCom+"%");
return queryObject.list();
} catch (
RuntimeException re) {}
}
我一执行就产生查询异常:
QueryException: could not resolve property: _CCOM of: hib.TabCou [from hib.TabCou as model where model._CCOM like ?]
那个地方写错了,请明眼人指点一下,谢谢了!!
还有就是实现多条件的模糊查询怎么做,就是类似于Criteria那种,输入任意个条件,就按任意个条件查,只不过是模糊的,谢谢的!!!
------解决方案--------------------String queryString = "from TabCou model where model._CCOM like ?";
还有变量是不能以下画线开头的
------解决方案--------------------hql写的不对吧,_CCOM和你HBM。XML里的映射名一样吗?最好不要用_这样表示映射名