[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-981) MySQL query fails when table name is "column"

Ondra Žižka (JIRA) noreply at atlassian.com
Fri Jun 17 13:19:24 EDT 2011


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

Ondra Žižka commented on HHH-981:
---------------------------------

Since this is quite high in Google search results, here's a (current) link:
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#mapping-quotedidentifiers

In short, you use @Column(name="`select`") or @Entity(name="`when`"). Dialect will use proper quotation.

> MySQL query fails when table name is "column"
> ---------------------------------------------
>
>                 Key: HHH-981
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-981
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.0.5
>         Environment: Hibernate 3.0.5, MySQL 4.1.14
>            Reporter: Karl Shea
>            Priority: Minor
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> I am developing a newspaper website, and I have a table named "column." MySQL chokes on this, because "column" is a keyword. To fix this problem, surround any table name with '`' (grave accent) when using the MySQL dialect, the same as the MySQL Query Browser does.

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