OpenJPA
  1. OpenJPA
  2. OPENJPA-1940

ReverseMapping tool does not find primary keys with Oracle

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.1, 2.2.0
    • Component/s: jdbc
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      When running the reverse mapping tool on Oracle we are unable to identify the primary key column for a table.

      The root cause is the prepared statement generated by OracleDictionary. The parameter value uses the qualified name for the table instead of the unqualified name (e.g. SCOTT.SimpleEntity instead of SimpleEntity).

      The output of the tool will look something like this :

      669 persistence-tests INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.OracleDictionary".
      3128 persistence-tests INFO [main] openjpa.Tool - ReverseMappingTool : generating classes.
      3132 persistence-tests INFO [main] openjpa.MetaData - Table "SCOTT.SIMPLEENTITY" could not be reverse mapped. This means that the table does not have a primary key (primary keys are required to establish unique identifiers for all persistent objects) and does not match a known pattern for a table used for cross-reference or value collections.
      3133 persistence-tests INFO [main] openjpa.Tool - Generating annotations.
      3282 persistence-tests INFO [main] openjpa.Tool - Writing generated class source code.
      3283 persistence-tests INFO [main] openjpa.Tool - Writing generated metadata.

        Issue Links

          Activity

          Michael Dick created issue -
          Michael Dick made changes -
          Field Original Value New Value
          Summary Unable to obtain PK information from Oracle ReverseMapping tool does not find primary keys with Oracle
          Original Estimate 0h [ 0 ]
          Remaining Estimate 0h [ 0 ]
          Fix Version/s 2.2.0 [ 12315910 ]
          Affects Version/s 2.2.0 [ 12315910 ]
          Affects Version/s 2.1.0 [ 12314542 ]
          Description The Oracle dictionary generates SQL to read PK information from the database, but uses the fully qualified table name as a parameter.

          The unqualified name should be used instead.
          When running the reverse mapping tool on Oracle we are unable to identify the primary key column for a table.

          The root cause is the prepared statement generated by OracleDictionary. The parameter value uses the qualified name for the table instead of the unqualified name (e.g. SCOTT.SimpleEntity instead of SimpleEntity).

          The output of the tool will look something like this :

          669 persistence-tests INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.OracleDictionary".
          3128 persistence-tests INFO [main] openjpa.Tool - ReverseMappingTool : generating classes.
          3132 persistence-tests INFO [main] openjpa.MetaData - Table "SCOTT.SIMPLEENTITY" could not be reverse mapped. This means that the table does not have a primary key (primary keys are required to establish unique identifiers for all persistent objects) and does not match a known pattern for a table used for cross-reference or value collections.
          3133 persistence-tests INFO [main] openjpa.Tool - Generating annotations.
          3282 persistence-tests INFO [main] openjpa.Tool - Writing generated class source code.
          3283 persistence-tests INFO [main] openjpa.Tool - Writing generated metadata.

          Michael Dick made changes -
          Fix Version/s 2.1.1 [ 12316191 ]
          Michael Dick made changes -
          Attachment OPENJPA-1940.diff.txt [ 12471219 ]
          Michael Dick made changes -
          Patch Info [Patch Available]
          Michael Dick made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Michael Dick made changes -
          Affects Version/s 2.2.0 [ 12315910 ]
          Michael Dick made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Michael Dick made changes -
          Link This issue relates to OPENJPA-2022 [ OPENJPA-2022 ]

            People

            • Assignee:
              Michael Dick
              Reporter:
              Michael Dick
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development