Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-14 Thread Demetz, Guenther
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 coul

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-14 Thread Łukasz Antoniak
Hello Steve/Guenther, @Steve: Thank you for clear explanation. Will create delegate interface and come back to you. Not sure if it would be backward compatible, have to check that :). > This is because HQL apparently does not support the suppression of the "AS" > keyword for aliases, so this que

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-14 Thread Demetz, Guenther
Hi Lukasz, >>Query "select id, description descr, (select max(id) from Product2) maximum >>from Product2" fails for me (even without paging) This is because HQL apparently does not support the suppression of the "AS" keyword for aliases, so this query works only by using the Native-SQL api. >

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-13 Thread Steve Ebersole
So frustrating that we could do this so much cleaner if we were dealing with syntax trees instead of strings. The dialect could just position the limit parameter nodes correctly in the tree and that would be that. Minor, but I'd like to see something other than bindLimitParametersPreQuery and

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-13 Thread Łukasz Antoniak
Hello Guenther, I totally agree that user could adapt his query to use "AS" keyword, while we focus on keeping getLimitString() most fast and simple as possible. I think that my modifications are more or less ready and you can view them here: https://github.com/lukasz-antoniak/hibernate-core/

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-12 Thread Demetz, Guenther
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 = sessio

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-11 Thread Łukasz Antoniak
Hello Guenther, I have discussed with Strong Liu about aliases and it seems that HQL and Criteria API queries always add an alias to selected column or subquery (to @Formula expressions as well). IMO we could assume that aliases are preceded with "AS" keyword. Steve agreed to delegate binding

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-07 Thread Demetz, Guenther
Hi Łukasz, >> 1. Maybe we could select columns without alias by number instead of adding >> "pageN" alias? Yes, that would be really nice, but I really doubt if SQL Server supports such syntax in the SELECT clause. >>2. As you mentioned, AS is optional keyword. Yes, in fact pull-request 349

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-07 Thread Łukasz Antoniak
Two more notes: 1. Maybe we could select columns without alias by number instead of adding "pageN" alias? Example: "SELECT rid1688_, 2, deviati16_1688_, 4, sortindex1688_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?". Will have to check if SQL Server supports such syn

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-07 Thread Łukasz Antoniak
Hello Guenther, The following commit in general describes my thoughts: https://github.com/lukasz-antoniak/hibernate-core/commit/fa8427937f5751170714ec97ac059bee9efd8cff It probably needs some more tuning. Feel free to modify and test. I'm not sure if adding "TOP(100)PERCENT" expression would not

Re: [hibernate-dev] SQLServer getLimitString() refactoring

2012-06-06 Thread Demetz, Guenther
1:56 PM To: hibernate-dev@lists.jboss.org Subject: [hibernate-dev] SQLServer getLimitString() refactoring Hello all, Release 4.1.4 contained few fixes to SQLServer2005Dialect#getLimitString(String, boolean) method. The main JIRA issue (which has links to other related tickets) is HHH-7019. Quincy L

[hibernate-dev] SQLServer getLimitString() refactoring

2012-06-02 Thread Łukasz Antoniak
Hello all, Release 4.1.4 contained few fixes to SQLServer2005Dialect#getLimitString(String, boolean) method. The main JIRA issue (which has links to other related tickets) is HHH-7019. Quincy Leung added recently a comment about moving formula expressions to GROUP BY which causes query to fai