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

Guenther Demetz (JIRA) noreply at atlassian.com
Wed May 2 10:14:49 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-7198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46476#comment-46476 ] 

Guenther Demetz commented on HHH-7198:
--------------------------------------

Pull request is https://github.com/hibernate/hibernate-orm/pull/325 (includes fix and matrix testcase)

> 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
>              Labels: pagination
>         Attachments: HHH-7198MatrixTestcase.jar
>
>
> 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