How would I do an entityload with its resultset being in random order?
So if I do entityload("modelName"), how Would set it’s sort order so that it is randomly different each time I call it?
Many Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, the short answer is it is really difficult with entityLoad(). However, with HQL, it’s actually not too bad.
Most DB languages will have a random function. So, using the built in art table and an entity, you can use ormExecuteQuery to generate your results:
Because it won’t return any null records, you will get a random result set every time.
Hope this helps ^__^