Uploaded image for project: 'Hibernate ORM'
  1. HHH-8301

SQLServer2005LimitHandler skips column alias generation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.3.0.Beta3
    • Fix Version/s: 4.2.3, 4.3.0.Beta4
    • Component/s: hibernate-core
    • Labels:
    • Environment:
      Microsoft SQL Server
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      While inserting generated aliases into the query, position of last comma can exceed initially calculated index of FROM keyword.

      SQLServer2005DialectTestCase.java
      @Test
      public void testGetLimitStringAliasGeneration() {
      	final String notAliasedSQL = "select column1, column2, column3, column4 from table1";
      
      	assertEquals(
      			"WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " +
      					"select column1 as page0_, column2 as page1_, column3 as page2_, column4 as page3_ from table1 ) inner_query ) " +
      					"SELECT page0_, page1_, page2_, page3_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?",
      			dialect.buildLimitHandler( notAliasedSQL, toRowSelection( 3, 5 ) ).getProcessedSql()
      	);
      }
      

        Attachments

          Activity

            People

            • Assignee:
              lukasz.antoniak Lukasz Antoniak
              Reporter:
              lukasz.antoniak Lukasz Antoniak
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: