[hibernate-dev] SQLServer getLimitString() refactoring

Demetz, Guenther Guenther.Demetz at wuerth-phoenix.com
Thu Jun 14 05:08:13 EDT 2012


Hi Lukasz,

>>In the previous message you wrote:
>>"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."
>>I am a little bit confused with your response, since such HQL query fails. However, your statement regarding native SQL is correct.

Oh, your' re right. Forget that sentence, that was a mistake by me in interpreting my test-results, sorry.

>> But I somehow disagree that proposed transformation is more complex then it is now. Simulating DISTINCT with GROUP BY, stripping aliases etc. can be >> very fragile. Here we just encapsulate the original query and add TOP if needed (which actually might improve performance).).

You are right, despite the resulting query looks more complex, the actual transformation is now in fact less complex than before :-)

best regards,
Guenther



More information about the hibernate-dev mailing list