I want to select several objects with the given identifiers, but also in the given order, something like:
<named-query name="getQuestionsByIds">
<query><![CDATA[from Question q where q.id in (:ids)]]></query>
</named-query>
But it is ordered in the same way as identifiers in the parameter.
eg. in mysql this can be done as follows:
SELECT * FROM table ORDER BY FIELD( id, 23, 234, 543, 23 )
What is the best way?
source
share