读书人

下面sql怎么改为hql,多谢

发布时间: 2012-03-13 11:21:12 作者: rapoo

下面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追加参数,不要用'"++"',那样输入'会报错的

[解决办法]

读书人网 >J2EE开发

热点推荐