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.protectedOracleBlobColumnMapping(RDBMSStoreManager storeMgr, JavaTypeMapping mapping)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetInsertionInputParameter()Accessor for the string to put in any retrieval datastore statement for this field.intgetJDBCType()Method to return the java.sql.Types type that this relates to.ObjectgetObject(ResultSet rs, int param)Returns the object to be loaded from the Orale BLOB.StringgetString(ResultSet resultSet, int exprIndex)Obtains a value fromresultSetat position specified byexprIndex.StringgetUpdateInputParameter()Accessor for the string to put in any update datastore statements for this field.booleanincludeInSQLFetchStatement()Whether to include this mapping in a fetch statement.voidinsertPostProcessing(org.datanucleus.state.ObjectProvider op, Object value)Perform any INSERT post processing on this column, using the provided value.booleaninsertValuesOnInsert()Accessor for whether this mapping requires values inserting on an INSERT.static voidupdateBlobColumn(org.datanucleus.state.ObjectProvider op, Table table, ColumnMapping mapping, byte[] bytes)Convenience method to update the contents of a BLOB column.voidupdatePostProcessing(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:AbstractColumnMappingAccessor 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:
getInsertionInputParameterin interfaceColumnMapping- Overrides:
getInsertionInputParameterin 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:
insertValuesOnInsertin interfaceColumnMapping- Overrides:
insertValuesOnInsertin 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:
getObjectin interfaceColumnMapping- Overrides:
getObjectin 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:ColumnMappingObtains a value fromresultSetat position specified byexprIndex.- Specified by:
getStringin interfaceColumnMapping- Overrides:
getStringin 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:AbstractColumnMappingMethod to return the java.sql.Types type that this relates to.- Specified by:
getJDBCTypein classAbstractColumnMapping- Returns:
- The JDBC "type"
-
getUpdateInputParameter
public String getUpdateInputParameter()
Description copied from class:AbstractColumnMappingAccessor 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:
getUpdateInputParameterin interfaceColumnMapping- Overrides:
getUpdateInputParameterin 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:ColumnMappingPostUpdatePerform any UPDATE post processing on this column, using the provided value.- Specified by:
updatePostProcessingin 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:ColumnMappingPostInsertPerform any INSERT post processing on this column, using the provided value.- Specified by:
insertPostProcessingin 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 UPDATEand 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
-
-