Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 2.0.0-M2
    • Component/s: jpa
    • Labels:
      None

      Description

      This task is to support the use of delimited-identifiers as defined by the 2.0 specification. The 10/31/2008 draft of the specification has some open issues regarding this item and while the spec indicates delimited identifiers can be enabled per an element in the persistence.xml, the persistence schema does contain the delimited-identifiers definition. However, work could begin on this item and the enablement of delimited identifiers could be temporarily triggered via a config property (or some other means) to exercise the capability.

      1. manual_patch3.txt
        58 kB
        Dianne Richards
      2. manual_patch2.txt
        60 kB
        Dianne Richards
      3. manual_patch1.txt
        45 kB
        Dianne Richards

        Activity

        Hide
        Dianne Richards added a comment -

        The provided support is for manual delimiting of most of the annotations. The additional manual delimiting and the automatic delimiting will be provided in OPENJPA-1115

        Show
        Dianne Richards added a comment - The provided support is for manual delimiting of most of the annotations. The additional manual delimiting and the automatic delimiting will be provided in OPENJPA-1115
        Hide
        Jeremy Bauer added a comment -

        Committed manual_patch3.txt for Dianne under revision 780068.

        Show
        Jeremy Bauer added a comment - Committed manual_patch3.txt for Dianne under revision 780068.
        Hide
        Dianne Richards added a comment -

        manual_patch3.txt contains the change suggested by Fay

        Show
        Dianne Richards added a comment - manual_patch3.txt contains the change suggested by Fay
        Hide
        Fay Wang added a comment -

        Dianne,
        In your refactoring effort in SequenceMapping, it seems that the check for whether a particular name is delimited is missing name.endsWith("\""):

        private String addQuotes(String name) {
        if (name != null && name.startsWith("\""))

        { return "\"" + name + "\""; }
        Show
        Fay Wang added a comment - Dianne, In your refactoring effort in SequenceMapping, it seems that the check for whether a particular name is delimited is missing name.endsWith("\""): private String addQuotes(String name) { if (name != null && name.startsWith("\"")) { return "\"" + name + "\""; }
        Hide
        Dianne Richards added a comment -

        Here's the next round of changes, in manual_patch2. This is still only manual support. The total set of annotations supported are:
        @Table
        @SecondaryTable
        @Column
        @DiscriminatorColumn
        @UniqueConstraint
        @TableGenerator
        @CollectionTable
        @MapKeyColumn
        @SequenceGenerator
        @PrimaryKeyJoinColumn
        @JoinTable
        @joinColumn
        @MapKeyJoinColumn

        Show
        Dianne Richards added a comment - Here's the next round of changes, in manual_patch2. This is still only manual support. The total set of annotations supported are: @Table @SecondaryTable @Column @DiscriminatorColumn @UniqueConstraint @TableGenerator @CollectionTable @MapKeyColumn @SequenceGenerator @PrimaryKeyJoinColumn @JoinTable @joinColumn @MapKeyJoinColumn
        Hide
        Dianne Richards added a comment -

        Thanks Jeremy.

        >>- SequenceMapping.addStandardProperties() - there is some repetitive code that adds delimiters to properties. I think this logic should be refactored into a method. That can be done in the next round of code...

        Already done for the next round.

        >>a common naming interface/method

        Still planned. I'm making the changes in DBDictionary with that in mind.

        Show
        Dianne Richards added a comment - Thanks Jeremy. >>- SequenceMapping.addStandardProperties() - there is some repetitive code that adds delimiters to properties. I think this logic should be refactored into a method. That can be done in the next round of code... Already done for the next round. >>a common naming interface/method Still planned. I'm making the changes in DBDictionary with that in mind.
        Hide
        Jeremy Bauer added a comment -

        Committed manual_patch1.txt for Dianne under revision 774860.

        A couple of comments -

        • SequenceMapping.addStandardProperties() - there is some repetitive code that adds delimiters to properties. I think this logic should be refactored into a method. That can be done in the next round of code...
        • There were some earlier discussions about producing a common naming interface/method set for these types of delimiting/naming operations. I see that starting to form in the new dictionary methods, but eventually providing an interface is a good goal to work toward, if possible.
        Show
        Jeremy Bauer added a comment - Committed manual_patch1.txt for Dianne under revision 774860. A couple of comments - SequenceMapping.addStandardProperties() - there is some repetitive code that adds delimiters to properties. I think this logic should be refactored into a method. That can be done in the next round of code... There were some earlier discussions about producing a common naming interface/method set for these types of delimiting/naming operations. I see that starting to form in the new dictionary methods, but eventually providing an interface is a good goal to work toward, if possible.
        Hide
        Dianne Richards added a comment -

        Thanks Catalina for your review.

        >>1. use StringUtils.replace where applicable for more readable code
        This is a good suggestion except for one thing: It's possible to include quotes within a delimited string. I have actually done this successfully on Derby. If I do a generic replace, those quotes would be duplicated too, which is not what we want.

        >> 2.in DBDictionary,
        >> delimitedCase seems to be the same as schemaCase, can we use the exsiting schemaCase ?
        Actually, although they use the same constants, they are not the same. schemaCase is used for undelimited strings while delimitedCase is used for delimited strings. For example, on DB2 and Derby, undelimited strings are stored as uppercase while, for delimited strings, the case is preserved.

        Show
        Dianne Richards added a comment - Thanks Catalina for your review. >>1. use StringUtils.replace where applicable for more readable code This is a good suggestion except for one thing: It's possible to include quotes within a delimited string. I have actually done this successfully on Derby. If I do a generic replace, those quotes would be duplicated too, which is not what we want. >> 2.in DBDictionary, >> delimitedCase seems to be the same as schemaCase, can we use the exsiting schemaCase ? Actually, although they use the same constants, they are not the same. schemaCase is used for undelimited strings while delimitedCase is used for delimited strings. For example, on DB2 and Derby, undelimited strings are stored as uppercase while, for delimited strings, the case is preserved.
        Hide
        Catalina Wei added a comment -

        Dianne,
        My comment on your patch:
        1. use StringUtils.replace where applicable for more readable code

        for example in SequenceMapping.addStandardProperties:

        appendProperty(props, PROP_TABLE, StringUtils.replace(_table, "\"", "\"\""));

        2.in DBDictionary,
        delimitedCase seems to be the same as schemaCase, can we use the exsiting schemaCase ?

        Catalina Wei

        Show
        Catalina Wei added a comment - Dianne, My comment on your patch: 1. use StringUtils.replace where applicable for more readable code for example in SequenceMapping.addStandardProperties: appendProperty(props, PROP_TABLE, StringUtils.replace(_table, "\"", "\"\"")); 2.in DBDictionary, delimitedCase seems to be the same as schemaCase, can we use the exsiting schemaCase ? Catalina Wei
        Hide
        Dianne Richards added a comment -

        I'm iteratively making changes. The first set of changes is supporting manual delimiting of ids, by specifying /"xxx"/ in the annotation values. For this first patch, the following annotation values are supported:
        @Table - name, schema
        @SecondaryTable - name, schema
        @Column - name, table
        @CollectionTable - name, schema
        @MapKeyColumn - name

        These have been tested on Derby and DB2.

        Show
        Dianne Richards added a comment - I'm iteratively making changes. The first set of changes is supporting manual delimiting of ids, by specifying /"xxx"/ in the annotation values. For this first patch, the following annotation values are supported: @Table - name, schema @SecondaryTable - name, schema @Column - name, table @CollectionTable - name, schema @MapKeyColumn - name These have been tested on Derby and DB2.

          People

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

            Dates

            • Due:
              Created:
              Updated:
              Resolved:

              Development