新手求一条简单的HQL语句
查询条件不固定 所以是拼凑HQL
String hql="from Buys b where 1=1";
根据页面传来的值来补充这条HQL
目前效果SQL能写出来
select * from buys where 1=1 and clientid like (select id from client where name='百度')
求怎么添加and后半段的HQL 能达到SQL查出来的效果
------解决方案--------------------
用StringBuffer
StringBuffer hql = "from Buys b where 1=1";
//后面根据不同情况添加
hql.append(" and clientid like (select id from client where name='百度')");