亲宝软件园·资讯

展开

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

菜鸟大队长 人气:1

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'
 

 

 

加载全部内容

相关教程
猜你喜欢
用户评论