[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4453) Reserved keywords not quoted in table/column names

Ivan Yatskevich (JIRA) noreply at atlassian.com
Wed Nov 17 11:57:13 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39140#action_39140 ] 

Ivan Yatskevich commented on HHH-4453:
--------------------------------------

Here is the most recent [Hibernate 3.6 documentation|http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/mapping.html#mapping-quotedidentifiers] which says:
bq.You can force Hibernate to quote an identifier in the generated SQL by enclosing the table or column name in backticks in the mapping document.

It seems that we need to add a configuration parameter to enable quoting explicitly instead of making "magic tricks" like quoting table names.

> Reserved keywords not quoted in table/column names
> --------------------------------------------------
>
>                 Key: HHH-4453
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4453
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Hibernate 3.3.1 GA, Windows XP, Sun JDK 1.6.0_06, Derby 10.5
>            Reporter: Philipp Reichart
>
> I'm currently migrating our test suite form HSQLDB to Derby (we need transaction isolation and the HSLDB 1.9 RCs are no good), and found out that we have a lot of table or colum names that happen to be reserved keywords in Derby, like "transaction", "key", "value", "year", etc..
> The usual workaround seems to be adding backticks to any offending table/column name in our hbm.xml files, but that's really an ugly workaround and doesn't prevent later incidents of this kind when new keywords show up in either our mappings or database. As this is about a production database schema, reanming the table/column names isn't an option either.
> I already tried implementing a custom Derby dialect and registering all the keywords from the Derby doc at http://db.apache.org/derby/docs/10.5/ref/rrefkeywords29722.html and even defined a "quote everything" NamingStrategy using the dialect to get the correct native quotes for the database.
> Unfortunately, neither the Hibernate DDL generator nor HQL queries seem to consider the naming strategy or dialect when handling table or column names.
> Is there any way to have Hibernate quote database-specific keywords every they're used?
> Or just have Hibernate quote everything that comes from a mapping file?

-- 
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