其他分享
首页 > 其他分享> > Hibernate4.x 报错 Space is not allowed after parameter prefix ':'

Hibernate4.x 报错 Space is not allowed after parameter prefix ':'

作者:互联网

1.问题描述  hibernate4.0使用原生sql:

   1 select rowno,goods_value from 2 (SELECT a.user_id,(@rowno:=@rowno+1) as rowno,a.goods_value FROM n_word_rank a,(select (@rowno:=0)) b ORDER BY a.goods_value desc,a.create_date asc ) t where t.user_id= 'xxx' 

  执行报错:org.hibernate.QueryException: Space is not allowed after parameter prefix ':' [select rowno.....................

2.问题解决

    
将 := 改为 /*'*/:=/*'*/ 问题解决  
改后

select rowno,goods_value from 2 (SELECT a.user_id,(@rowno/*'*/:=/*'*/@rowno+1) as rowno,a.goods_value FROM n_word_rank a,(select (@rowno/*'*/:=/*'*/0)) b ORDER BY a.goods_value desc,a.create_date asc ) t where t.user_id= 'xxx'
 

 

 

标签:Hibernate4,goods,rowno,Space,value,报错,user,id,select
来源: https://www.cnblogs.com/shikaijie/p/12345706.html