select w.id, w.name , x.name , w.xs , w.skzxs , w.fd , w.skmc , w.skzy , w.zc , w.bz 
from Wj w ,Xb x 
where w.id not in(
select t.id  
from (
select w.id ,w.name ,count(distinct w.name) 
from Wj w 
where w.xn='"+this.getXn()+"' and w.xq='"+this.getXq()+"' and w.qh='"+this.getQh()+"' group by w.name
)  t

)
and w.xn='"+this.getXn()+"' and w.xq='"+this.getXq()+"' and w.qh='"+this.getQh()+"' and w.xb=x.id 
order by w.name
hql语句
报错
nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token求解,该如何解决

解决方案 »

  1.   

    既然是查询,最好不要写的那么复杂,可以充分利用数据库,建个视图吧,这样你的查询语句会短点。还有一种可能是你运用的方法错了,看下你运用HQL查询的方法的参数信息是怎么用,看下hibernate的API
      

  2.   

    Wj,Xb之间建个映射关系吧,把这堆hql简化下
      

  3.   

    自己顶一下,
    这是因为hql查询语句  
    select * from Users u
    from之后必须要是实体