Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.2.1
-
None
-
Sybase
-
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.
Attachments
Attachments
Issue Links
- relates to
-
OPENJPA-1641 SybaseDictionary should try both JDBC column names and Sybase specific column names
- Closed