HQL 语句报错 join 复杂sql语句 求助!
@Override
public Info findBySex(Boolean sex){
return (Info)this.getSession().createQuery(" from Info as t1 join (select ROUND(rand()*(select max(bid) from Info ) ) as bid)as t2 where t1.bid>=t2.bid and bsex=?0 and bbutto = true order by t1.bid asc limit 1 ")
.setParameter("0", sex).uniqueResult();
}
报错了! 我的sql在MYSQL执行语句不会报错:
select * from info as t1 join (select ROUND(rand()*(select max(bid) from info ) ) as bid)as t2
where t1.bid>=t2.bid and bsex=0 order by t1.bid asc limit 1; 求帮助