org.datanucleus.store.rdbms.mapping.oracle
Class OracleBlobRDBMSMapping

java.lang.Object
  extended by org.datanucleus.store.rdbms.mapping.RDBMSMapping
      extended by org.datanucleus.store.rdbms.mapping.oracle.OracleBlobRDBMSMapping
All Implemented Interfaces:
org.datanucleus.store.mapped.mapping.DatastoreMapping

public class OracleBlobRDBMSMapping
extends RDBMSMapping

Maps a Field to an Oracle BLOB.


Field Summary
 
Fields inherited from class org.datanucleus.store.rdbms.mapping.RDBMSMapping
column, LOCALISER, LOCALISER_STORE, mapping, storeMgr
 
Constructor Summary
  OracleBlobRDBMSMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping, org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.store.mapped.DatastoreField field)
          Constructor.
protected OracleBlobRDBMSMapping(org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
          Creates a OracleBlobRDBMSMapping
 
Method Summary
 java.lang.String getInsertionInputParameter()
          Accessor for the string to put in any retrieval datastore statement for this field.
 java.lang.Object getObject(java.lang.Object rs, int param)
          Returns the object to be loaded from the Orale BLOB.
 java.lang.String getString(java.lang.Object resultSet, int exprIndex)
           
 SQLTypeInfo getTypeInfo()
          Accessor for the (SQL) type info for this datastore type.
 java.lang.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.
 boolean insertValuesOnInsert()
          Accessor for whether this mapping requires values inserting on an INSERT.
static void updateBlobColumn(org.datanucleus.StateManager sm, org.datanucleus.store.mapped.DatastoreContainerObject datastoreContainer, org.datanucleus.store.mapped.mapping.DatastoreMapping mapping, byte[] bytes)
          Convenience method to update the contents of a BLOB column.
 
Methods inherited from class org.datanucleus.store.rdbms.mapping.RDBMSMapping
equals, failureMessage, getBoolean, getByte, getChar, getColumn, getDatabaseAdapter, getDatastoreField, getDouble, getFloat, getInt, getJavaTypeMapping, getLong, getShort, hashCode, includeInFetchStatement, initTypeInfo, isBitBased, isBooleanBased, isDecimalBased, isIntegerBased, isNullable, isStringBased, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setObject, setShort, setString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OracleBlobRDBMSMapping

public OracleBlobRDBMSMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
                              org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                              org.datanucleus.store.mapped.DatastoreField field)
Constructor.

Parameters:
mapping - The Java mapping
storeMgr - Store Manager in use
field - The column in the datastore

OracleBlobRDBMSMapping

protected OracleBlobRDBMSMapping(org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                                 org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
Creates a OracleBlobRDBMSMapping

Parameters:
storeMgr - Store Manager
mapping - The Java mapping
Method Detail

getInsertionInputParameter

public java.lang.String getInsertionInputParameter()
Description copied from class: RDBMSMapping
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.

Overrides:
getInsertionInputParameter in class RDBMSMapping
Returns:
The input parameter
See Also:
RDBMSMapping.getInsertionInputParameter()

insertValuesOnInsert

public boolean insertValuesOnInsert()
Accessor for whether this mapping requires values inserting on an INSERT.

Overrides:
insertValuesOnInsert in class RDBMSMapping
Returns:
Whether values are to be inserted into this mapping on an INSERT

getObject

public java.lang.Object getObject(java.lang.Object rs,
                                  int param)
Returns the object to be loaded from the Orale BLOB.

Specified by:
getObject in interface org.datanucleus.store.mapped.mapping.DatastoreMapping
Overrides:
getObject in class RDBMSMapping
Parameters:
rs - the ResultSet from the query
param - the index in the query
Returns:
the object loaded as a byte[]
Throws:
org.datanucleus.exceptions.NucleusDataStoreException

getString

public java.lang.String getString(java.lang.Object resultSet,
                                  int exprIndex)
Specified by:
getString in interface org.datanucleus.store.mapped.mapping.DatastoreMapping
Overrides:
getString in class RDBMSMapping
See Also:
RDBMSMapping.getString(Object, int)

getTypeInfo

public SQLTypeInfo getTypeInfo()
Description copied from class: RDBMSMapping
Accessor for the (SQL) type info for this datastore type.

Specified by:
getTypeInfo in class RDBMSMapping
Returns:
The type info
See Also:
RDBMSMapping.getTypeInfo()

getUpdateInputParameter

public java.lang.String getUpdateInputParameter()
Description copied from class: RDBMSMapping
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.

Overrides:
getUpdateInputParameter in class RDBMSMapping
Returns:
The input parameter.
See Also:
RDBMSMapping.getUpdateInputParameter()

includeInSQLFetchStatement

public boolean includeInSQLFetchStatement()
Whether to include this mapping in a fetch statement.

Returns:
Whether to include it when fetching the object

updateBlobColumn

public static void updateBlobColumn(org.datanucleus.StateManager sm,
                                    org.datanucleus.store.mapped.DatastoreContainerObject datastoreContainer,
                                    org.datanucleus.store.mapped.mapping.DatastoreMapping 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 statement
 SELECT {blobColumn} FROM TABLE WHERE ID=? FOR UPDATE
 
and then updates the Blob value returned.

Parameters:
sm - StateManager of the object
datastoreContainer - Table storing the BLOB column
mapping - Datastore mapping for the BLOB column
bytes - The bytes to store in the BLOB
Throws:
org.datanucleus.exceptions.NucleusObjectNotFoundException
org.datanucleus.exceptions.NucleusDataStoreException


Copyright © 2009. All Rights Reserved.