Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M2
    • 2.0.0-M2
    • jpa
    • 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.

      Attachments

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

        Activity

          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.

          dianner Dianne E. 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.
          fancy 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

          fancy 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

          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.

          dianner Dianne E. 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.
          techhusky 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.
          techhusky 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.

          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.

          dianner Dianne E. 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.

          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

          dianner Dianne E. 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
          faywang 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 + "\"";
          }

          faywang 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 + "\""; }

          manual_patch3.txt contains the change suggested by Fay

          dianner Dianne E. Richards added a comment - manual_patch3.txt contains the change suggested by Fay
          techhusky Jeremy Bauer added a comment -

          Committed manual_patch3.txt for Dianne under revision 780068.

          techhusky Jeremy Bauer added a comment - Committed manual_patch3.txt for Dianne under revision 780068.

          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

          dianner Dianne E. 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

          People

            dianner Dianne E. Richards
            techhusky Jeremy Bauer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: