[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-2660) Column names in generated SQL should be surrounded by the backtick character

Steve Ebersole (JIRA) noreply at atlassian.com
Thu Jun 7 15:30:04 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-2660.
-------------------------------

    Resolution: Fixed

Mmm, that or you could do that yourself in the mapping document as outlined in the docuemntation.

> Column names in generated SQL should be surrounded by the backtick character
> ----------------------------------------------------------------------------
>
>                 Key: HHH-2660
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2660
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.4.sp1
>         Environment: All 3.2 versions.  All databases.  I use MySQL.
>            Reporter: William L Baker
>   Original Estimate: 10 minutes
>  Remaining Estimate: 10 minutes
>
> Column names in generated SQL statements should be surrounded by backtick character.  This is necessary for column names that conflict with reserved words or functions.  It is easily demonstrated by creating a table with a column name DIV and a column name GROUP.  Hibernate currently generates invalid sql statements for accessing this table.  "select DIV, GROUP from NEWTABLE" gives a syntax error.  "select `DIV`, `GROUP` from NEWTABLE works as expected.  It is only necessary to change two lines of code to fix this behavior.
> diff good\src\org\hibernate\sql\Insert.java bad\src\org\hibernate\sql\Insert.java
> 91c91
> <                               buf.append( "`" + iter.next() + "`" );
> ---
> >                               buf.append( iter.next() );
> diff good\src\org\hibernate\sql\Update.java bad\src\org\hibernate\sql\Update.java
> 143c143
> <                       buf.append( "`" + e.getKey() + "`" ).append( '=' ).append( e.getValue() );
> ---
> >                       buf.append( e.getKey() ).append( '=' ).append( e.getValue() );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list