Class AbstractLargeBinaryColumnMapping
java.lang.Object
org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
org.datanucleus.store.rdbms.mapping.column.AbstractLargeBinaryColumnMapping
- All Implemented Interfaces:
ColumnMapping
- Direct Known Subclasses:
BinaryColumnMapping
,BlobColumnMapping
,LongVarBinaryColumnMapping
,VarBinaryColumnMapping
Mapping of a large binary (e.g BLOB, LONGVARBINARY) column.
A large binary column can be treated in two ways in terms of storage and retrieval.
- Serialise the field into the large binary using ObjectOutputStream, and deserialise it back using ObjectInputStream - i.e Java serialisation
- Store the field using a byte[] stream, and retrieve it in the same way.
-
Field Summary
Fields inherited from class org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
column, mapping, storeMgr
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractLargeBinaryColumnMapping
(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionMethod to retrieve the object from the large binary column.protected Object
getObjectForBytes
(byte[] bytes, int param) Accessor for String value when serialised.protected void
Initialisation method, initialising the type info.void
setObject
(PreparedStatement ps, int param, Object value) Method to store a field into a "large varbinary" column.void
setString
(PreparedStatement ps, int exprIndex, String value) Cater for serialisation of Strings.Methods inherited from class org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
equals, failureMessage, failureMessage, failureMessage, getBoolean, getByte, getChar, getColumn, getDatastoreAdapter, getDouble, getFloat, getInsertionInputParameter, getInt, getJavaTypeMapping, getJDBCType, getLong, getShort, getTypeInfo, getUpdateInputParameter, hashCode, includeInFetchStatement, initTypeInfo, insertValuesOnInsert, isBitBased, isBooleanBased, isDecimalBased, isIntegerBased, isNullable, isStringBased, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, useDefaultWhenNull
-
Constructor Details
-
AbstractLargeBinaryColumnMapping
public AbstractLargeBinaryColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col) Constructor.- Parameters:
mapping
- Java type mappingstoreMgr
- Store Managercol
- Column
-
-
Method Details
-
initialize
protected void initialize()Initialisation method, initialising the type info. -
setObject
Method to store a field into a "large varbinary" column.- Specified by:
setObject
in interfaceColumnMapping
- Overrides:
setObject
in classAbstractColumnMapping
- Parameters:
ps
- The PreparedStatementparam
- Parameter position in the statementvalue
- The value to store
-
getObjectForBytes
-
getObject
Method to retrieve the object from the large binary column.- Specified by:
getObject
in interfaceColumnMapping
- Overrides:
getObject
in classAbstractColumnMapping
- Parameters:
rs
- The ResultSetparam
- The parameter position- Returns:
- The object
-
setString
Cater for serialisation of Strings.- Specified by:
setString
in interfaceColumnMapping
- Overrides:
setString
in classAbstractColumnMapping
- Parameters:
ps
- PreparedStatementexprIndex
- param indexesvalue
- The value of the String
-
getString
Accessor for String value when serialised.- Specified by:
getString
in interfaceColumnMapping
- Overrides:
getString
in classAbstractColumnMapping
- Parameters:
resultSet
- ResultSetexprIndex
- param indexes- Returns:
- The String value
-