New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NumberExpression.random() is not working #1881
Comments
Hi, |
Thank you for letting me know. Please can you show me how to use JPA provider to swap out the random()? |
Which JPA Provider do you use? I just remembered that for others you can also use the special Then you can use Querydsl Template Expressions to serialize them into the query. Expressions.numberTemplate(Double.class, "function('rand')"); |
thank you :D below code is success result
|
if you have similar error like below, please use
|
I have same issue
http://stackoverflow.com/questions/15869279/does-querydsl-not-support-rand
I'm trying to run this query.
query.from(test) .orderBy(NumberExpression.random().asc()) .limit(20) .list(test);
It is shown query
select test0_.id as id1_46_ from test test0_ order by random() asc
And I get this error
FUNCTION random does not exist
Mysql version is
I'm using querydsl
mysql supported RAND() function.
http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand
So, for mysql, don't i have to use rand()?
The text was updated successfully, but these errors were encountered: