Class OracleBlobColumnMapping
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
-
- org.datanucleus.store.rdbms.mapping.column.OracleBlobColumnMapping
-
- All Implemented Interfaces:
ColumnMapping
,ColumnMappingPostInsert
,ColumnMappingPostUpdate
public class OracleBlobColumnMapping extends AbstractColumnMapping implements ColumnMappingPostInsert, ColumnMappingPostUpdate
Mapping for an Oracle BLOB column. Extends the standard JDBC handler so that we can insert an empty BLOB, and then update it (Oracle non-standard behaviour).
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
column, mapping, storeMgr
-
-
Constructor Summary
Constructors Modifier Constructor Description OracleBlobColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
Constructor.protected
OracleBlobColumnMapping(RDBMSStoreManager storeMgr, JavaTypeMapping mapping)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getInsertionInputParameter()
Accessor for the string to put in any retrieval datastore statement for this field.int
getJDBCType()
Method to return the java.sql.Types type that this relates to.Object
getObject(ResultSet rs, int param)
Returns the object to be loaded from the Orale BLOB.String
getString(ResultSet resultSet, int exprIndex)
Obtains a value fromresultSet
at position specified byexprIndex
.String
getUpdateInputParameter()
Accessor for the string to put in any update datastore statements for this field.boolean
includeInSQLFetchStatement()
Whether to include this mapping in a fetch statement.void
insertPostProcessing(org.datanucleus.state.ObjectProvider op, Object value)
Perform any INSERT post processing on this column, using the provided value.boolean
insertValuesOnInsert()
Accessor for whether this mapping requires values inserting on an INSERT.static void
updateBlobColumn(org.datanucleus.state.ObjectProvider op, Table table, ColumnMapping mapping, byte[] bytes)
Convenience method to update the contents of a BLOB column.void
updatePostProcessing(org.datanucleus.state.ObjectProvider op, Object value)
Perform any UPDATE post processing on this column, using the provided value.-
Methods inherited from class org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
equals, failureMessage, failureMessage, failureMessage, getBoolean, getByte, getChar, getColumn, getDatastoreAdapter, getDouble, getFloat, getInt, getJavaTypeMapping, getLong, getShort, getTypeInfo, hashCode, includeInFetchStatement, initTypeInfo, isBitBased, isBooleanBased, isDecimalBased, isIntegerBased, isNullable, isStringBased, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setObject, setShort, setString, useDefaultWhenNull
-
-
-
-
Constructor Detail
-
OracleBlobColumnMapping
public OracleBlobColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
Constructor.- Parameters:
mapping
- The Java mappingstoreMgr
- Store Manager in usecol
- Column
-
OracleBlobColumnMapping
protected OracleBlobColumnMapping(RDBMSStoreManager storeMgr, JavaTypeMapping mapping)
Constructor.- Parameters:
storeMgr
- Store Managermapping
- The Java mapping
-
-
Method Detail
-
getInsertionInputParameter
public String getInsertionInputParameter()
Description copied from class:AbstractColumnMapping
Accessor for the string to put in any retrieval datastore statement for this field. In RDBMS, this is typically a ? to be used in JDBC statements.- Specified by:
getInsertionInputParameter
in interfaceColumnMapping
- Overrides:
getInsertionInputParameter
in classAbstractColumnMapping
- Returns:
- The input parameter
- See Also:
AbstractColumnMapping.getInsertionInputParameter()
-
insertValuesOnInsert
public boolean insertValuesOnInsert()
Accessor for whether this mapping requires values inserting on an INSERT.- Specified by:
insertValuesOnInsert
in interfaceColumnMapping
- Overrides:
insertValuesOnInsert
in classAbstractColumnMapping
- Returns:
- Whether values are to be inserted into this mapping on an INSERT
-
getObject
public Object getObject(ResultSet rs, int param)
Returns the object to be loaded from the Orale BLOB.- Specified by:
getObject
in interfaceColumnMapping
- Overrides:
getObject
in classAbstractColumnMapping
- Parameters:
rs
- the ResultSet from the queryparam
- the index in the query- Returns:
- the object loaded as a byte[]
- Throws:
org.datanucleus.exceptions.NucleusDataStoreException
- Thrown if an error occurs in datastore communication
-
getString
public String getString(ResultSet resultSet, int exprIndex)
Description copied from interface:ColumnMapping
Obtains a value fromresultSet
at position specified byexprIndex
.- Specified by:
getString
in interfaceColumnMapping
- Overrides:
getString
in classAbstractColumnMapping
- Parameters:
resultSet
- ResultSetexprIndex
- the position of the value in the result- Returns:
- the value
- See Also:
AbstractColumnMapping.getString(ResultSet, int)
-
getJDBCType
public int getJDBCType()
Description copied from class:AbstractColumnMapping
Method to return the java.sql.Types type that this relates to.- Specified by:
getJDBCType
in classAbstractColumnMapping
- Returns:
- The JDBC "type"
-
getUpdateInputParameter
public String getUpdateInputParameter()
Description copied from class:AbstractColumnMapping
Accessor for the string to put in any update datastore statements for this field. In RDBMS, this is typically a ? to be used in JDBC statements.- Specified by:
getUpdateInputParameter
in interfaceColumnMapping
- Overrides:
getUpdateInputParameter
in classAbstractColumnMapping
- Returns:
- The input parameter.
- See Also:
AbstractColumnMapping.getUpdateInputParameter()
-
includeInSQLFetchStatement
public boolean includeInSQLFetchStatement()
Whether to include this mapping in a fetch statement.- Returns:
- Whether to include it when fetching the object
-
updatePostProcessing
public void updatePostProcessing(org.datanucleus.state.ObjectProvider op, Object value)
Description copied from interface:ColumnMappingPostUpdate
Perform any UPDATE post processing on this column, using the provided value.- Specified by:
updatePostProcessing
in interfaceColumnMappingPostUpdate
- Parameters:
op
- ObjectProvider for object being updatedvalue
- The value to use on the UPDATE
-
insertPostProcessing
public void insertPostProcessing(org.datanucleus.state.ObjectProvider op, Object value)
Description copied from interface:ColumnMappingPostInsert
Perform any INSERT post processing on this column, using the provided value.- Specified by:
insertPostProcessing
in interfaceColumnMappingPostInsert
- Parameters:
op
- ObjectProvider for object being insertedvalue
- The value to use on the insert
-
updateBlobColumn
public static void updateBlobColumn(org.datanucleus.state.ObjectProvider op, Table table, ColumnMapping mapping, byte[] bytes)
Convenience method to update the contents of a BLOB column. Oracle requires that a BLOB is initialised with EMPTY_BLOB() and then you retrieve the column and update its BLOB value. Performs a statementSELECT {blobColumn} FROM TABLE WHERE ID=? FOR UPDATE
and then updates the Blob value returned.- Parameters:
op
- ObjectProvider of the objecttable
- Table storing the BLOB columnmapping
- Datastore mapping for the BLOB columnbytes
- The bytes to store in the BLOB- Throws:
org.datanucleus.exceptions.NucleusObjectNotFoundException
- thrown if an object isnt foundorg.datanucleus.exceptions.NucleusDataStoreException
- thrown if an error occurs in datastore communication
-
-