[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7198) SQLServer2005Dialect.getLimitString turns tablenames to lowercase -> SQLGrammarException: when mapping tables with capital letters

Guenther Demetz (JIRA) noreply at atlassian.com
Mon Mar 26 03:45:49 EDT 2012


SQLServer2005Dialect.getLimitString turns tablenames to lowercase ->  SQLGrammarException: when mapping tables with capital letters
-----------------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-7198
                 URL: https://hibernate.onjira.com/browse/HHH-7198
             Project: Hibernate ORM
          Issue Type: Bug
          Components: core
    Affects Versions: 4.1.1
         Environment: Hibernate4, SQLServer2008
            Reporter: Guenther Demetz
            Priority: Minor


Usually when annotating entity classes without the @Table.name attribute, then the default mapped tablenames begin with a capital letter.
When using the paging feature, SQLServer2005Dialect.getLimitString turns the whole sql to lowercase

{code:title=SQLServer2005Dialect.java|borderStyle=solid}
  @Override
  public String getLimitString(String querySqlString, boolean hasOffset) {
      StringBuilder sb = new StringBuilder(querySqlString.trim().toLowerCase());
...
      return sb.toString();
  }
{code}

thus also the included tablenames are all converted to lowercase, 
this leads to following schema mismatch exception, when using the original SQLServerDriver:
 org.hibernate.exception.SQLGrammarException: Invalid object name 'mytable'

This bug was introduced with HHH-2655 (ROW_NUMBER for Paging).

Testcase:
{code}
 Query query = session.createQuery("from C"); // C is an arbitrary entity class mapped to a table with uppercase characters in the tablename
 query.setMaxResults(10);
 query.iterate().next(); // -> Exception
{code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list