Jira issue originally created by user romanb:
It should be supported to set a default ordering for associations.
* @OneToMany(targetEntity="Thing", mappedBy="other")
* @OrderBy("foo*bar ASC, other*bar DESC")
The value of the orderby mapping declaration should be a simple DQL snippet.
Main classes to adjust for this feature: SqlWalker, StandardEntityPersister and the metadata drivers, of course.
Comment created by @beberlei:
is @OrderBy("string") supported by our parser? I know its the JPA 2.0 equivalent, but imho:
My patch in DDC-293 uses fields instead of columns though.
Also does the SqlWalker need a change? Is it possible to reliably add the order by clauses when there is already an ORDER BY statement in the query?
The issue for @OrderBy(sql) is dependent on the DQL EBNF refactoring, its not possible to easily implement this without.
The mapping syntax will be changed in a future commit. Otherwise this is all implemented now.
This is now completely implemented and the API is finalized.
Issue was closed with resolution "Fixed"