Version 1

    Hello,

     

    As I saw here, I added \\ to the query

     

     

    set @row = 0;

    select u.id, u.facebook, u.firstName, u.lastName, u.credit,

    (SELECT row FROM (SELECT id, @row \\:= @row+1 AS row from Users ORDER BY credit desc) drv WHERE id = u.id) AS place

    from Users u

     

    I'm getting the below exception:

    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select u.id, u.facebook, u.firstName, u.lastName, u.credit,

     

    This query works fine without hibernate

    I'm using hibernate 4.2.2

     

    Thanks,

    Kiril