mirror of https://github.com/apache/openjpa.git
Changes for JIRA OPENJPA-77 issue.
These changes allow the use of the DB2Dictionary with DB2 on z/OS. May need more in the future, but these will get us started... git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@491027 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6c4a0dd4af
commit
6cb121e192
|
@ -36,6 +36,12 @@ public class DB2Dictionary
|
||||||
|
|
||||||
nextSequenceQuery = "VALUES NEXTVAL FOR {0}";
|
nextSequenceQuery = "VALUES NEXTVAL FOR {0}";
|
||||||
|
|
||||||
|
sequenceSQL = "SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, "
|
||||||
|
+ "SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES";
|
||||||
|
sequenceSchemaSQL = "SEQSCHEMA = ?";
|
||||||
|
sequenceNameSQL = "SEQNAME = ?";
|
||||||
|
characterColumnSize = 254;
|
||||||
|
|
||||||
binaryTypeName = "BLOB(1M)";
|
binaryTypeName = "BLOB(1M)";
|
||||||
longVarbinaryTypeName = "BLOB(1M)";
|
longVarbinaryTypeName = "BLOB(1M)";
|
||||||
varbinaryTypeName = "BLOB(1M)";
|
varbinaryTypeName = "BLOB(1M)";
|
||||||
|
@ -112,17 +118,16 @@ public class DB2Dictionary
|
||||||
|
|
||||||
protected String getSequencesSQL(String schemaName, String sequenceName) {
|
protected String getSequencesSQL(String schemaName, String sequenceName) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, ").
|
buf.append(sequenceSQL);
|
||||||
append("SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES");
|
|
||||||
if (schemaName != null || sequenceName != null)
|
if (schemaName != null || sequenceName != null)
|
||||||
buf.append(" WHERE ");
|
buf.append(" WHERE ");
|
||||||
if (schemaName != null) {
|
if (schemaName != null) {
|
||||||
buf.append("SEQSCHEMA = ?");
|
buf.append(sequenceSchemaSQL);
|
||||||
if (sequenceName != null)
|
if (sequenceName != null)
|
||||||
buf.append(" AND ");
|
buf.append(" AND ");
|
||||||
}
|
}
|
||||||
if (sequenceName != null)
|
if (sequenceName != null)
|
||||||
buf.append("SEQNAME = ?");
|
buf.append(sequenceNameSQL);
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +162,24 @@ public class DB2Dictionary
|
||||||
supportsLockingWithOuterJoin = true;
|
supportsLockingWithOuterJoin = true;
|
||||||
forUpdateClause = "WITH RR USE AND KEEP UPDATE LOCKS";
|
forUpdateClause = "WITH RR USE AND KEEP UPDATE LOCKS";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (metaData.getDatabaseProductVersion().indexOf("DSN") != -1) {
|
||||||
|
// DB2 Z/OS
|
||||||
|
characterColumnSize = 255;
|
||||||
|
lastGeneratedKeyQuery = "SELECT IDENTITY_VAL_LOCAL() FROM "
|
||||||
|
+ "SYSIBM.SYSDUMMY1";
|
||||||
|
nextSequenceQuery = "SELECT NEXTVAL FOR {0} FROM "
|
||||||
|
+ "SYSIBM.SYSDUMMY1";
|
||||||
|
sequenceSQL = "SELECT SCHEMA AS SEQUENCE_SCHEMA, "
|
||||||
|
+ "NAME AS SEQUENCE_NAME FROM SYSIBM.SYSSEQUENCES";
|
||||||
|
sequenceSchemaSQL = "SCHEMA = ?";
|
||||||
|
sequenceNameSQL = "NAME = ?";
|
||||||
|
if (maj == 8) {
|
||||||
|
// DB2 Z/OS Version 8: no bigint support, hence map Java
|
||||||
|
// long to decimal
|
||||||
|
bigintTypeName = "DECIMAL(31,0)";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,6 +287,9 @@ public class DBDictionary
|
||||||
public boolean supportsAutoAssign = false;
|
public boolean supportsAutoAssign = false;
|
||||||
public String lastGeneratedKeyQuery = null;
|
public String lastGeneratedKeyQuery = null;
|
||||||
public String nextSequenceQuery = null;
|
public String nextSequenceQuery = null;
|
||||||
|
public String sequenceSQL = null;
|
||||||
|
public String sequenceSchemaSQL = null;
|
||||||
|
public String sequenceNameSQL = null;
|
||||||
|
|
||||||
protected JDBCConfiguration conf = null;
|
protected JDBCConfiguration conf = null;
|
||||||
protected Log log = null;
|
protected Log log = null;
|
||||||
|
|
Loading…
Reference in New Issue