日期:2014-05-20  浏览次数:20686 次

下面sql如何改为hql,谢谢!
select adusername,count(adusername) as nnum from news_content where uptime >='"+st+"' and uptime <= '"+et+"' group by adusername union select username as adusername,(select count(id) from news_content where uptime >='"+st+"' and uptime <= '"+et+"' and news_content.adusername = news_admin.username) as nnum from news_admin

------解决方案--------------------
我给你个sample:
 select * from dual where id = ?1

然后有个setPre,也就是赋值的.把对应的参数放进去就好..上面的HQL语句,只是把参数换成了?1 占位符,

这样的sample.你可以在网上百度下的.
------解决方案--------------------
From 类名 对象名 where 对象.属性=? 应该用map追加参数,不要用'"++"',那样输入'会报错的
------解决方案--------------------
探讨
From 类名 对象名 where 对象.属性=? 应该用map追加参数,不要用'"++"',那样输入'会报错的

------解决方案--------------------