Details

    • Type: Bug Bug
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0.0, 2.2.0
    • Fix Version/s: 1.2.3
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Dianne Richards added a comment -

        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=""1"" />
        </id>
        <basic name="description">
        <column name=""2"" />
        </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.

        Show
        Dianne Richards added a comment - 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=""1"" /> </id> <basic name="description"> <column name=""2"" /> </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.

          People

          • Assignee:
            Dianne Richards
            Reporter:
            Dianne Richards
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development