使用的是DaoHibernate,说是有sql注入风险,应该怎么改这种like模糊查询

使用的是DaoHibernate,说是有sql注入风险,应该怎么改这种like模糊查询

String hql=" from userinfo where   code  like '" + code + "%' and status='0' order by createName";
    createList=super.findByHql(hql);

因为使用了加号拼接,所以会有sql注入的风险,findByHql 是可以传参数的吧,可以把参数传进去试试

    createList=super.findByHql(hql,code);