How to use Mysql variables with Hibernate ?
Posted
by Jerome C.
on Stack Overflow
See other posts from Stack Overflow
or by Jerome C.
Published on 2010-04-26T09:11:23Z
Indexed on
2010/04/26
9:13 UTC
Read the original article
Hit count: 218
Hello,
I need to use a native sql query in Hibernate with use of variable.
But hibernate throws an error saying: Space is not allowed after parameter prefix
So there is a conflict with the := mysql variable assignment and hibernate variable assignment.
Here is my sql query:
SET @rank:=0;
UPDATE Rank SET rank_Level=@rank:=@rank+1 ORDER BY Level;
I can't use a stored procedure because my sql query is dynamically generated ('Level' can be 'int' or 'force'...)
How can I do this ?
thanks
© Stack Overflow or respective owner