[ 
https://issues.apache.org/jira/browse/OPENJPA-2207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295121#comment-13295121
 ] 

Dianne Richards commented on OPENJPA-2207:
------------------------------------------

This JIRA is actually fixing 2 different problems, depending on the release.

For JPA 1.0 releases, a column name that starts with a number doesn't work. It 
needs to be delimited with the the specific DB delimiter in the sql. But, 
delimited identifiers are not supported in the spec until 2.0. Even manually 
delimiting the column name in the annotation or orm xml causes a problem. I 
made a fix to allow manually delimiting column names. Some examples for DBs 
that support double quote delimiters:

For annotations:
@Column(name = "\"2\"")
    public String description;

For xml:
             <attributes>
                        <id name="id">
                                <column name="&quot;1&quot;" />
                        </id>
                        <basic name="description">
                                <column name="&quot;2&quot;" />
                        </basic>
                </attributes>

Note: This is only supported for column names. Manual delimiting of other DB 
identifiers may not work.

Delimited identifier support is mandated by the JPA 2.0 spec and is provided in 
the corresponding OPENJPA releases. This provides support for both manually 
delimited identifiers and auto delimiting identifiers based on starting and 
embedded characters. However, there is a simple bug in this support when a 
single numeric name is provided. So, this is also fixed in this JIRA. This 
should be fixed for all DB identifiers in this release.
                
> Problems with numeric column name
> ---------------------------------
>
>                 Key: OPENJPA-2207
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2207
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.0, 2.2.0
>            Reporter: Dianne Richards
>            Assignee: Dianne Richards
>
> When a numeric column name is specified with a single number (ex: "1"), 
> incorrect sql is generated. The sql is supposed to have a single set of 
> double quotes around the name. Different incorrect sql is generated, 
> depending on the release. For JPA 1.0 releases, there are no quotes (ex: 1). 
> For JPA 2.0 releases, there are 2 sets of double quotes (ex: ""1""). This 
> problem appears to exist for other DB identifiers also.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to