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

Lukasz Antoniak (JIRA) noreply at atlassian.com
Sat May 5 06:43:10 EDT 2012


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

Lukasz Antoniak commented on HHH-7198:
--------------------------------------

Test failes because of renaming entity Product to Product2 here: https://github.com/hibernate/hibernate-orm/commit/2f0609819b76e15ae6fd2da6e0aa197c9a79345c
Strong, any particular reason of doing so, or can I rename it back?

> 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
>            Assignee: Strong Liu
>            Priority: Minor
>              Labels: pagination
>             Fix For: 4.1.4
>
>         Attachments: HHH-7198MatrixTestcase.jar
>
>          Time Spent: 8m
>
> 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