OpenJPA
  1. OpenJPA
  2. OPENJPA-1434

I want to read comments of table and column from database schema.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3.0
    • Component/s: jdbc
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      When generating schemas, I want to read the comments of table and column from database schema, then write them into customer.properties.
      Then when executing reverse mapping, set the class name as table comment, and set field name as column comment automatically.

      1. patch.7z
        40 kB
        zhang jing

        Issue Links

          Activity

          Hide
          zhang jing added a comment -

          Add one new class:
          1. org.apache.openjpa.jdbc.schema.CustomXMLSchemaSearializer.java

          This class extends XMLSchemaSerializer and override the function of serialize(Collection objs),
          mainly use comments one table/column to generate the class/field name mapping, and write into test.properties

          I modify three classes:
          1. org.apache.openjpa.jdbc.sql.DBDictionary.java
          See two "// FIX:" in the file, mainly read comments on table/column from DB schema

          2. org.apache.openjpa.jdbc.schema.SchemaGenerator.java
          See two "//FIX:" in the file, mainly set comments into class table and column

          3. org.apache.openjpa.jdbc.schema.SchemaTool.java
          See one "//FIX:" in the file, mainly change "SchemaSerializer ser = new XMLSchemaSerializer(conf);" to "SchemaSerializer ser = new CustomXMLSchemaSearializer(conf);"

          Show
          zhang jing added a comment - Add one new class: 1. org.apache.openjpa.jdbc.schema.CustomXMLSchemaSearializer.java This class extends XMLSchemaSerializer and override the function of serialize(Collection objs), mainly use comments one table/column to generate the class/field name mapping, and write into test.properties I modify three classes: 1. org.apache.openjpa.jdbc.sql.DBDictionary.java See two "// FIX:" in the file, mainly read comments on table/column from DB schema 2. org.apache.openjpa.jdbc.schema.SchemaGenerator.java See two "//FIX:" in the file, mainly set comments into class table and column 3. org.apache.openjpa.jdbc.schema.SchemaTool.java See one "//FIX:" in the file, mainly change "SchemaSerializer ser = new XMLSchemaSerializer(conf);" to "SchemaSerializer ser = new CustomXMLSchemaSearializer(conf);"

            People

            • Assignee:
              Unassigned
              Reporter:
              zhang jing
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Development