|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.jdbc.sql.DBDictionary org.apache.openjpa.jdbc.sql.OracleDictionary
public class OracleDictionary
Dictionary for Oracle.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.sql.DBDictionary |
---|
DBDictionary.SerializedData |
Field Summary | |
---|---|
String |
autoAssignSequenceName
The global sequence name to use for autoassign simulation. |
boolean |
openjpa3GeneratedKeyNames
Flag to use OpenJPA 0.3 style naming for auto assign sequence name and trigger name for backwards compatibility. |
static String |
SELECT_HINT
|
boolean |
supportsSetClob
Deprecated. |
boolean |
useSetFormOfUseForUnicode
If true, then OpenJPA will attempt to use the special OraclePreparedStatement.setFormOfUse method to configure statements that it detects are operating on unicode fields. |
boolean |
useTriggersForAutoAssign
If true, then simulate auto-assigned values in Oracle by using a trigger that inserts a sequence value into the primary key value when a row is inserted. |
static String |
VENDOR_ORACLE
|
String |
xmlTypeMarker
Type constructor for XML column, used in INSERT and UPDATE statements. |
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes |
---|
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL |
Constructor Summary | |
---|---|
OracleDictionary()
|
Method Summary | |
---|---|
void |
appendXmlComparison(SQLBuffer buf,
String op,
FilterValue lhs,
FilterValue rhs,
boolean lhsxml,
boolean rhsxml)
If this dictionary supports XML type, use this method to append xml predicate. |
boolean |
canOuterJoin(int syntax,
ForeignKey fk)
Returns if the given foreign key can be eagerly loaded using other joins. |
void |
connectedConfiguration(Connection conn)
This method is called when the dictionary first sees any connection. |
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
void |
ensureDriverVendor()
Ensure that the driver vendor has been set, and if not, set it now. |
int |
getBatchUpdateCount(PreparedStatement ps)
Return batched statements update success count |
String |
getClobString(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
Column[] |
getColumns(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
DBIdentifier columnName,
Connection conn)
Reflect on the schema to find columns matching the given table and column patterns. |
Column[] |
getColumns(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
String columnName,
Connection conn)
Reflect on the schema to find columns matching the given table and column patterns. |
String[] |
getCreateTableSQL(Table table)
Return a series of SQL statements to create the given table, complete with columns. |
Object |
getGeneratedKey(Column col,
Connection conn)
Return the last generated value for the given column. |
protected String |
getGeneratedKeyTriggerName(Column col)
Trigger name for simulating auto-assign values on the given column. |
ForeignKey[] |
getImportedKeys(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
Connection conn,
boolean partialKeys)
Reflect on the schema to return full foreign keys imported by the given table pattern. |
ForeignKey[] |
getImportedKeys(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn,
boolean partialKeys)
Reflect on the schema to return full foreign keys imported by the given table pattern. |
Index[] |
getIndexInfo(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
boolean unique,
boolean approx,
Connection conn)
Reflect on the schema to find indexes matching the given table pattern. |
Index[] |
getIndexInfo(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
boolean unique,
boolean approx,
Connection conn)
Reflect on the schema to find indexes matching the given table pattern. |
String |
getIsNotNullSQL(String colAlias,
int colType)
|
String |
getIsNullSQL(String colAlias,
int colType)
|
int |
getJDBCType(int metaTypeCode,
boolean lob,
int precis,
int scale,
boolean xml)
Return the preferred Types constant for the given
JavaTypes or JavaSQLTypes constant. |
String |
getMarkerForInsertUpdate(Column col,
Object val)
Oracle requires special handling of XML column. |
Object |
getObject(ResultSet rs,
int column,
Map map)
Convert the specified column of the SQL ResultSet to the proper java type. |
protected String |
getOpenJPA3GeneratedKeySequenceName(Column col)
Returns a OpenJPA 3-compatible name for an auto-assign sequence. |
protected String |
getOpenJPA3GeneratedKeyTriggerName(Column col)
Returns a OpenJPA 3-compatible name for an auto-assign trigger. |
PrimaryKey[] |
getPrimaryKeys(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
Connection conn)
Reflect on the schema to find primary keys for the given table pattern. |
PrimaryKey[] |
getPrimaryKeys(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn)
Reflect on the schema to find primary keys for the given table pattern. |
String |
getSelectOperation(JDBCFetchConfiguration fetch)
Check to see if we have set the SELECT_HINT in the
fetch configuraiton, and if so, append the Orache hint after the
"SELECT" part of the query. |
protected SQLBuffer |
getSelects(Select sel,
boolean distinctIdentifiers,
boolean forUpdate)
Return the portion of the select statement between the SELECT keyword and the FROM keyword. |
protected String |
getSequencesSQL(DBIdentifier schemaName,
DBIdentifier sequenceName)
|
protected String |
getSequencesSQL(String schemaName,
String sequenceName)
Return the SQL needed to select the list of sequences. |
Timestamp |
getTimestamp(ResultSet rs,
int column,
Calendar cal)
Convert the specified column of the SQL ResultSet to the proper java type. |
protected void |
guessJDBCVersion(Connection conn)
Oracle drivers, at least in versions 10.2.0.4 and 11.2.0.1, incorrectly return a driver major version from DatabaseMetaData.getJDBCMajorVersion() . |
void |
indexOf(SQLBuffer buf,
FilterValue str,
FilterValue find,
FilterValue start)
Invoke this database's indexOf function. |
void |
insertBlobForStreamingLoad(Row row,
Column col,
JDBCStore store,
Object ob,
Select sel)
|
void |
insertClobForStreamingLoad(Row row,
Column col,
Object ob)
|
boolean |
isFatalException(int subtype,
SQLException ex)
Determine if the given SQL Exception is fatal or recoverable (such as a timeout). |
boolean |
isSystemSequence(DBIdentifier name,
DBIdentifier schema,
boolean targetSchema)
This method is used to filter system sequences from database metadata. |
boolean |
isSystemSequence(String name,
String schema,
boolean targetSchema)
This method is used to filter system sequences from database metadata. |
void |
putBytes(Blob blob,
byte[] data)
Invoke Oracle's putBytes method on the given BLOB object. |
void |
putChars(Clob clob,
char[] data)
Invoke Oracle's putChars method on the given CLOB
object. |
void |
putString(Clob clob,
String data)
Invoke Oracle's putString method on the given CLOB object. |
void |
setBinaryStream(PreparedStatement stmnt,
int idx,
InputStream val,
int length,
Column col)
Set the given value as a parameter to the statement. |
void |
setClobString(PreparedStatement stmnt,
int idx,
String val,
Column col)
Set the given value as a parameter to the statement. |
void |
setNull(PreparedStatement stmnt,
int idx,
int colType,
Column col)
Set null as a parameter to the statement. |
void |
setString(PreparedStatement stmnt,
int idx,
String val,
Column col)
Set the given value as a parameter to the statement. |
boolean |
supportsLocking(Select sel)
Returns true if a "FOR UPDATE" clause can be used for the specified Select object. |
SQLBuffer |
toNativeJoin(Join join)
Use the given join instance to create SQL joining its tables in the database's native syntax. |
protected SQLBuffer |
toSelect(SQLBuffer select,
JDBCFetchConfiguration fetch,
SQLBuffer tables,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
boolean forUpdate,
long start,
long end,
boolean subselect,
Select sel)
Combine the given components into a SELECT statement. |
protected SQLBuffer |
toSelect(SQLBuffer select,
JDBCFetchConfiguration fetch,
SQLBuffer tables,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
boolean forUpdate,
long start,
long end,
Select sel)
Combine the given components into a SELECT statement. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SELECT_HINT
public static final String VENDOR_ORACLE
public boolean useTriggersForAutoAssign
public String autoAssignSequenceName
public boolean openjpa3GeneratedKeyNames
public boolean useSetFormOfUseForUnicode
@Deprecated public boolean supportsSetClob
public String xmlTypeMarker
Constructor Detail |
---|
public OracleDictionary()
Method Detail |
---|
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
endConfiguration
in class DBDictionary
public void connectedConfiguration(Connection conn) throws SQLException
DBDictionary
super.connectedConfiguration
.
connectedConfiguration
in class DBDictionary
SQLException
public void ensureDriverVendor()
public boolean supportsLocking(Select sel)
DBDictionary
supportsLocking
in class DBDictionary
protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate)
DBDictionary
getSelects
in class DBDictionary
public boolean canOuterJoin(int syntax, ForeignKey fk)
DBDictionary
canOuterJoin
in class DBDictionary
public SQLBuffer toNativeJoin(Join join)
DBDictionary
toNativeJoin
in class DBDictionary
protected SQLBuffer toSelect(SQLBuffer select, JDBCFetchConfiguration fetch, SQLBuffer tables, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, boolean subselect, Select sel)
DBDictionary
toSelect
in class DBDictionary
protected SQLBuffer toSelect(SQLBuffer select, JDBCFetchConfiguration fetch, SQLBuffer tables, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, Select sel)
DBDictionary
toSelect
in class DBDictionary
public String getSelectOperation(JDBCFetchConfiguration fetch)
SELECT_HINT
in the
fetch configuraiton, and if so, append the Orache hint after the
"SELECT" part of the query.
getSelectOperation
in class DBDictionary
public void setString(PreparedStatement stmnt, int idx, String val, Column col) throws SQLException
DBDictionary
setString
in class DBDictionary
SQLException
public void setBinaryStream(PreparedStatement stmnt, int idx, InputStream val, int length, Column col) throws SQLException
DBDictionary
setBinaryStream
in class DBDictionary
SQLException
public void setClobString(PreparedStatement stmnt, int idx, String val, Column col) throws SQLException
DBDictionary
setClobString
in class DBDictionary
SQLException
public void setNull(PreparedStatement stmnt, int idx, int colType, Column col) throws SQLException
DBDictionary
Types
.
setNull
in class DBDictionary
SQLException
public String getClobString(ResultSet rs, int column) throws SQLException
DBDictionary
getClobString
in class DBDictionary
SQLException
public Timestamp getTimestamp(ResultSet rs, int column, Calendar cal) throws SQLException
DBDictionary
getTimestamp
in class DBDictionary
SQLException
public Object getObject(ResultSet rs, int column, Map map) throws SQLException
DBDictionary
getObject
in class DBDictionary
SQLException
public Column[] getColumns(DatabaseMetaData meta, String catalog, String schemaName, String tableName, String columnName, Connection conn) throws SQLException
DBDictionary
getColumns
in class DBDictionary
SQLException
public Column[] getColumns(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, DBIdentifier columnName, Connection conn) throws SQLException
DBDictionary
getColumns
in class DBDictionary
SQLException
public PrimaryKey[] getPrimaryKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
DBDictionary
getPrimaryKeys
in class DBDictionary
SQLException
public PrimaryKey[] getPrimaryKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
DBDictionary
getPrimaryKeys
in class DBDictionary
SQLException
public Index[] getIndexInfo(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique, boolean approx, Connection conn) throws SQLException
DBDictionary
getIndexInfo
in class DBDictionary
SQLException
public Index[] getIndexInfo(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, boolean unique, boolean approx, Connection conn) throws SQLException
DBDictionary
getIndexInfo
in class DBDictionary
SQLException
public ForeignKey[] getImportedKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn, boolean partialKeys) throws SQLException
DBDictionary
getImportedKeys
in class DBDictionary
SQLException
public ForeignKey[] getImportedKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn, boolean partialKeys) throws SQLException
DBDictionary
getImportedKeys
in class DBDictionary
SQLException
public String[] getCreateTableSQL(Table table)
DBDictionary
getCreateTableSQL
in class DBDictionary
public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale, boolean xml)
Types
constant for the given
JavaTypes
or JavaSQLTypes
constant.
getJDBCType
in class DBDictionary
protected String getSequencesSQL(String schemaName, String sequenceName)
DBDictionary
getSequencesSQL
in class DBDictionary
protected String getSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName)
getSequencesSQL
in class DBDictionary
public boolean isSystemSequence(String name, String schema, boolean targetSchema)
DBDictionary
isSystemSequence
in class DBDictionary
name
- the table nameschema
- the table schema; may be nulltargetSchema
- if true, then the given schema was listed by
the user as one of his schemaspublic boolean isSystemSequence(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
DBDictionary
isSystemSequence
in class DBDictionary
name
- the table nameschema
- the table schema; may be nulltargetSchema
- if true, then the given schema was listed by
the user as one of his schemaspublic Object getGeneratedKey(Column col, Connection conn) throws SQLException
DBDictionary
DBDictionary.lastGeneratedKeyQuery
is null.
getGeneratedKey
in class DBDictionary
SQLException
protected String getGeneratedKeyTriggerName(Column col)
protected String getOpenJPA3GeneratedKeySequenceName(Column col)
protected String getOpenJPA3GeneratedKeyTriggerName(Column col)
public void putBytes(Blob blob, byte[] data) throws SQLException
putBytes
method on the given BLOB object.
Uses reflection in case the blob is wrapped in another
vendor-specific class; for example Weblogic wraps oracle thin driver
lobs in its own interfaces with the same methods.
putBytes
in class DBDictionary
SQLException
public void putString(Clob clob, String data) throws SQLException
putString
method on the given CLOB object.
Uses reflection in case the clob is wrapped in another
vendor-specific class; for example Weblogic wraps oracle thin driver
lobs in its own interfaces with the same methods.
putString
in class DBDictionary
SQLException
public void putChars(Clob clob, char[] data) throws SQLException
putChars
method on the given CLOB
object. Uses reflection in case the clob is wrapped in another
vendor-specific class; for example Weblogic wraps oracle thin driver
lobs in its own interfaces with the same methods.
putChars
in class DBDictionary
SQLException
public void appendXmlComparison(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs, boolean lhsxml, boolean rhsxml)
appendXmlComparison
in class DBDictionary
buf
- the SQL buffer to write the comparisonop
- the comparison operation to performlhs
- the left hand side of the comparisonrhs
- the right hand side of the comparisonpublic void insertClobForStreamingLoad(Row row, Column col, Object ob) throws SQLException
insertClobForStreamingLoad
in class DBDictionary
SQLException
public int getBatchUpdateCount(PreparedStatement ps) throws SQLException
DBDictionary
getBatchUpdateCount
in class DBDictionary
ps
- A PreparedStatement
SQLException
public boolean isFatalException(int subtype, SQLException ex)
DBDictionary
isFatalException
in class DBDictionary
subtype
- A constant indicating the category of error as defined in StoreException
.ex
- original SQL Exception as raised by the database driver.
public void insertBlobForStreamingLoad(Row row, Column col, JDBCStore store, Object ob, Select sel) throws SQLException
insertBlobForStreamingLoad
in class DBDictionary
SQLException
public String getMarkerForInsertUpdate(Column col, Object val)
getMarkerForInsertUpdate
in class DBDictionary
col
- column definitionval
- value to be inserted/updated
protected void guessJDBCVersion(Connection conn)
DatabaseMetaData.getJDBCMajorVersion()
.
public String getIsNullSQL(String colAlias, int colType)
getIsNullSQL
in class DBDictionary
public String getIsNotNullSQL(String colAlias, int colType)
getIsNotNullSQL
in class DBDictionary
public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find, FilterValue start)
DBDictionary
indexOf
in class DBDictionary
buf
- the SQL buffer to write the indexOf invocation tostr
- a query value representing the target stringfind
- a query value representing the search stringstart
- a query value representing the start index, or null
to start at the beginning
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |