OpenJPA
  1. OpenJPA
  2. OPENJPA-1326

ReverseMappingTool and SchemaTool failing for Sybase

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2, 1.3.0, 2.0.0-beta
    • Component/s: sql
    • Labels:
      None
    • Environment:
      Sybase
    • Patch Info:
      Patch Available

      Description

      invoking the org.apache.openjpa.jdbc.ant.ReverseMappingToolTask or the org.apache.openjpa.jdbc.ant.SchemaToolTask on a Sybase database gives the following stack trace

      java.sql.SQLException: S0022: Invalid column name 'TABLE_SCHEM'.
      at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(ErrorMessage.java:559)
      at com.sybase.jdbc3.tds.TdsResultSet.findColumn(TdsResultSet.java:624)
      at com.sybase.jdbc3.jdbc.SybResultSet.findColumn(SybResultSet.java:602)
      at com.sybase.jdbc3.jdbc.SybResultSet.getString(SybResultSet.java:349)
      at org.apache.openjpa.jdbc.sql.DBDictionary.newPrimaryKey(DBDictionary.java:3769)
      at org.apache.openjpa.jdbc.sql.DBDictionary.getPrimaryKeysFromGetPrimaryKeys(DBDictionary.java:3751)
      at org.apache.openjpa.jdbc.sql.DBDictionary.getPrimaryKeys(DBDictionary.java:3728)
      at org.apache.openjpa.jdbc.schema.SchemaGenerator.generatePrimaryKeys(SchemaGenerator.java:586)
      at org.apache.openjpa.jdbc.schema.SchemaGenerator.generatePrimaryKeys(SchemaGenerator.java:593)
      at org.apache.openjpa.jdbc.schema.SchemaGenerator.generatePrimaryKeys(SchemaGenerator.java:367)
      at org.apache.openjpa.jdbc.schema.SchemaGenerator.generateSchemas(SchemaGenerator.java:274)
      at org.apache.openjpa.jdbc.schema.SchemaGenerator.generateSchemas(SchemaGenerator.java:243)
      at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:1433)
      at org.apache.openjpa.jdbc.ant.SchemaToolTask.executeOn(SchemaToolTask.java:138)
      at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at org.apache.tools.ant.Task.perform(Task.java:364)
      at org.apache.tools.ant.Target.execute(Target.java:341)
      at org.apache.tools.ant.Target.performTasks(Target.java:369)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
      at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at org.apache.tools.ant.Task.perform(Task.java:364)
      at org.apache.tools.ant.Target.execute(Target.java:341)
      at org.apache.tools.ant.Target.performTasks(Target.java:369)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
      at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at org.apache.tools.ant.Task.perform(Task.java:364)
      at org.apache.tools.ant.Target.execute(Target.java:341)
      at org.apache.tools.ant.Target.performTasks(Target.java:369)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      at org.apache.tools.ant.Main.runBuild(Main.java:687)
      at org.apache.tools.ant.Main.startAnt(Main.java:200)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

      The data looks good from the driver, but when doing the getString calls, it has problems finding the columns that are aliased AS something else (ie, table_owner AS TABLE_SCHEM). A quick fix is to just use the original column names when getting the data from Sybase.

      pk.setSchemaName(pkMeta.getString("table_owner")); (search by column name) works, but
      pk.setSchemaName(pkMeta.getString("TABLE_SCHEM")); (search by column label) does not.

        Issue Links

          Activity

          Michael Dick made changes -
          Link This issue relates to OPENJPA-1641 [ OPENJPA-1641 ]
          Donald Woods made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Donald Woods made changes -
          Fix Version/s 2.0.0-beta [ 12314149 ]
          Fix Version/s 2.0.0 [ 12314019 ]
          Affects Version/s 1.2.1 [ 12313328 ]
          Affects Version/s 1.2.2 [ 12313681 ]
          Michael Dick made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.3.0 [ 12313326 ]
          Fix Version/s 2.0.0 [ 12314019 ]
          Resolution Fixed [ 1 ]
          B.J. Reed made changes -
          Field Original Value New Value
          Attachment OPENJPA-1326.patch [ 12420378 ]
          B.J. Reed created issue -

            People

            • Assignee:
              B.J. Reed
              Reporter:
              B.J. Reed
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development