How to use Mysql variables with Hibernate ?
- by Jerome C.
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