{"action":"created","issue":{"url":"https://api.github.com/repos/querydsl/querydsl/issues/1881","repository_url":"https://api.github.com/repos/querydsl/querydsl","labels_url":"https://api.github.com/repos/querydsl/querydsl/issues/1881/labels{/name}","comments_url":"https://api.github.com/repos/querydsl/querydsl/issues/1881/comments","events_url":"https://api.github.com/repos/querydsl/querydsl/issues/1881/events","html_url":"https://github.com/querydsl/querydsl/issues/1881","id":154395016,"number":1881,"title":"NumberExpression.random() is not working","user":{"login":"okihouse","id":13760160,"avatar_url":"https://avatars.githubusercontent.com/u/13760160?v=3","gravatar_id":"","url":"https://api.github.com/users/okihouse","html_url":"https://github.com/okihouse","followers_url":"https://api.github.com/users/okihouse/followers","following_url":"https://api.github.com/users/okihouse/following{/other_user}","gists_url":"https://api.github.com/users/okihouse/gists{/gist_id}","starred_url":"https://api.github.com/users/okihouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okihouse/subscriptions","organizations_url":"https://api.github.com/users/okihouse/orgs","repos_url":"https://api.github.com/users/okihouse/repos","events_url":"https://api.github.com/users/okihouse/events{/privacy}","received_events_url":"https://api.github.com/users/okihouse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-12T04:33:29Z","updated_at":"2016-05-12T14:22:46Z","closed_at":null,"body":"I have same issue \r\n[http://stackoverflow.com/questions/15869279/does-querydsl-not-support-rand](http://stackoverflow.com/questions/15869279/does-querydsl-not-support-rand)\r\n\r\nI'm trying to run this query.\r\n`\r\n  query.from(test)\r\n\t   .orderBy(NumberExpression.random().asc())\r\n\t   .limit(20)\r\n\t   .list(test);\r\n`\r\n\r\nIt is shown query \r\n`select\r\n\ttest0_.id as id1_46_\r\nfrom\r\n    test test0_ \r\norder by\r\n    random() asc`\r\n\r\nAnd I get this error\r\n`FUNCTION random does not exist`\r\n\r\nMysql version is \r\n\r\n> mysql  Ver 14.14 Distrib 5.7.11, for Linux (x86_64) using  EditLine wrapper\r\n\r\nI'm using querydsl\r\n\r\n> <dependency>\r\n\t\t\t<groupId>com.mysema.querydsl</groupId>\r\n\t\t\t<artifactId>querydsl-apt</artifactId>\r\n\t\t\t<version>3.6.7</version>\r\n\t\t</dependency>\r\n\t\t<dependency>\r\n\t\t\t<groupId>com.mysema.querydsl</groupId>\r\n\t\t\t<artifactId>querydsl-jpa</artifactId>\r\n\t\t\t<version>3.6.7</version>\r\n\t\t</dependency>\r\n\r\nmysql supported RAND() function. \r\n[http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand](http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand)\r\n\r\nSo, for mysql, don't i have to use rand()?"},"comment":{"url":"https://api.github.com/repos/querydsl/querydsl/issues/comments/218772635","html_url":"https://github.com/querydsl/querydsl/issues/1881#issuecomment-218772635","issue_url":"https://api.github.com/repos/querydsl/querydsl/issues/1881","id":218772635,"user":{"login":"Shredder121","id":4105066,"avatar_url":"https://avatars.githubusercontent.com/u/4105066?v=3","gravatar_id":"","url":"https://api.github.com/users/Shredder121","html_url":"https://github.com/Shredder121","followers_url":"https://api.github.com/users/Shredder121/followers","following_url":"https://api.github.com/users/Shredder121/following{/other_user}","gists_url":"https://api.github.com/users/Shredder121/gists{/gist_id}","starred_url":"https://api.github.com/users/Shredder121/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shredder121/subscriptions","organizations_url":"https://api.github.com/users/Shredder121/orgs","repos_url":"https://api.github.com/users/Shredder121/repos","events_url":"https://api.github.com/users/Shredder121/events{/privacy}","received_events_url":"https://api.github.com/users/Shredder121/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T14:22:45Z","updated_at":"2016-05-12T14:22:45Z","body":"Hi,\r\nIt seems to me that you are using JPQL (indicated by the `querydsl-jpa` dependency).\r\nJPQL doesn't have a `random()` function, but you can make your JPA provider swap out `random()` for the actual random function specific to the dialect."}}