[hibernate-dev] SQLServer getLimitString() refactoring

Demetz, Guenther Guenther.Demetz at wuerth-phoenix.com
Tue Jun 12 03:35:56 EDT 2012


Hi Lukasz,

>>...it seems that HQL and Criteria API queries always add an alias to selected column or subquery 

While that's true for the cases where hibernate has to exploit the columns implicitly,
on query projections the user typically defines his own aliases, for example:

Query q = session.createQuery( "select id, description descr, (select max(id) from MySequence) maximum from Product2 ");

In this case HQL don't adds the "AS" keyword for the "descr" and "maximum" aliases,
so stripAliases-method & co could have problems in filtering aliases correctly.

Nevertheless I'm not really convinced if the dialect should also be able to recognize correctly this kind of aliases.
IMO in such case the user could adapt his query, while we keep getLimitString() most fast and simplest as possible.
Other opinions?

>>Steve agreed to delegate binding of limit parameters values to Dialect classes. This way API will be more flexible and consistent (possible implementation >>of HHH-7370), since Dialect classes already modify SQL queries to apply pagination.

That are good news.

>> .. I will try to apply changes to my testing branch
>>(https://github.com/lukasz-antoniak/hibernate-core/tree/SQLServerLimitString) as soon as possible.

Thank you very much.

best regards
Guenther Demetz



More information about the hibernate-dev mailing list