I need to use a native query, because I need to ORDER BY RAND() and it's currently not possible (afaik) even with custom function.

However, if I use native query, I need to explictly set the column to fetch to allow an Object Hydration, and you may guess, I've a lot of column, so it's kinda boring to set it all.

Any ideas?

Accepted Answer

You should never use ORDER BY RAND() even in native query, you should use

SELECT rand() as rand,* .... ORDER BY rand

I think it is quite possible with doctrine

Written by venimus
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki