org.datanucleus.store.rdbms.mapping
Class RDBMSMapping

java.lang.Object
  extended by org.datanucleus.store.mapped.mapping.AbstractDatastoreMapping
      extended by org.datanucleus.store.rdbms.mapping.RDBMSMapping
All Implemented Interfaces:
org.datanucleus.store.mapped.mapping.DatastoreMapping
Direct Known Subclasses:
AbstractLargeBinaryRDBMSMapping, BigIntRDBMSMapping, BooleanRDBMSMapping, CharRDBMSMapping, DateRDBMSMapping, DecimalRDBMSMapping, DoubleRDBMSMapping, IntegerRDBMSMapping, LongVarcharRDBMSMapping, NumericRDBMSMapping, OracleBlobRDBMSMapping, RealRDBMSMapping, SmallIntRDBMSMapping, TimeRDBMSMapping, TimestampRDBMSMapping, TinyIntRDBMSMapping

public abstract class RDBMSMapping
extends org.datanucleus.store.mapped.mapping.AbstractDatastoreMapping

Implementation of the mapping of an RDBMS type.


Field Summary
protected  Column column
          The RDBMS Column being persisted to.
protected static org.datanucleus.util.Localiser LOCALISER_RDBMS
           
protected  RDBMSStoreManager storeMgr
          Store Manager to use for mapping.
 
Fields inherited from class org.datanucleus.store.mapped.mapping.AbstractDatastoreMapping
LOCALISER, mapping
 
Constructor Summary
protected RDBMSMapping(org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
          Create a new Mapping with the given DatabaseAdapter for the given type.
 
Method Summary
 boolean equals(Object obj)
           
protected  String failureMessage(String method, int position, Exception e)
          Utility to output any error message.
protected  String failureMessage(String method, Object value, Exception e)
          Utility to output any error message.
protected  RDBMSAdapter getDatabaseAdapter()
          Convenience to access the Datastore adapter as a DatabaseAdapter.
 org.datanucleus.store.mapped.DatastoreField getDatastoreField()
          Accessor for the datastore field
 String getInsertionInputParameter()
          Accessor for the string to put in any retrieval datastore statement for this field.
abstract  SQLTypeInfo getTypeInfo()
          Accessor for the (SQL) type info for this datastore type.
 String getUpdateInputParameter()
          Accessor for the string to put in any update datastore statements for this field.
 int hashCode()
           
 boolean includeInFetchStatement()
          Whether this mapping is included in the fetch statement.
protected  void initTypeInfo()
          Sets the TypeInfo for the columns of the Mapping.
 boolean insertValuesOnInsert()
          Accessor for whether this mapping requires values inserting on an INSERT.
 boolean isNullable()
          Accessor for whether the mapping is nullable.
 
Methods inherited from class org.datanucleus.store.mapped.mapping.AbstractDatastoreMapping
failureMessage, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getJavaTypeMapping, getLong, getObject, getShort, getString, isBitBased, isBooleanBased, isDecimalBased, isIntegerBased, 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
 

Field Detail

LOCALISER_RDBMS

protected static final org.datanucleus.util.Localiser LOCALISER_RDBMS

storeMgr

protected final RDBMSStoreManager storeMgr
Store Manager to use for mapping.


column

protected Column column
The RDBMS Column being persisted to.

Constructor Detail

RDBMSMapping

protected RDBMSMapping(org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                       org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
Create a new Mapping with the given DatabaseAdapter for the given type.

Parameters:
storeMgr - The Store Manager that this Mapping should use.
mapping - Mapping for the underlying java type. This can be null on an "unmapped column".
Method Detail

getDatabaseAdapter

protected RDBMSAdapter getDatabaseAdapter()
Convenience to access the Datastore adapter as a DatabaseAdapter.

Returns:
The adapter in use

getTypeInfo

public abstract SQLTypeInfo getTypeInfo()
Accessor for the (SQL) type info for this datastore type.

Returns:
The type info

isNullable

public boolean isNullable()
Accessor for whether the mapping is nullable.

Returns:
Whether it is nullable

includeInFetchStatement

public boolean includeInFetchStatement()
Whether this mapping is included in the fetch statement.

Returns:
Whether to include in fetch statement

insertValuesOnInsert

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

Returns:
Whether values are to be inserted into this mapping on an INSERT

getInsertionInputParameter

public String getInsertionInputParameter()
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.

Returns:
The input parameter

getUpdateInputParameter

public String getUpdateInputParameter()
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.

Returns:
The input parameter.

getDatastoreField

public org.datanucleus.store.mapped.DatastoreField getDatastoreField()
Accessor for the datastore field

Returns:
The column

initTypeInfo

protected void initTypeInfo()
Sets the TypeInfo for the columns of the Mapping. Mappings using two or more columns using different TypeInfo(s) should overwrite this method to appropriate set the TypeInfo (SQL type) for all the columns


equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

failureMessage

protected String failureMessage(String method,
                                int position,
                                Exception e)
Utility to output any error message.

Parameters:
method - The method that failed.
position - The position of the column
e - The exception
Returns:
The localised failure message

failureMessage

protected String failureMessage(String method,
                                Object value,
                                Exception e)
Utility to output any error message.

Parameters:
method - The method that failed.
value - Value at the position
e - The exception
Returns:
The localised failure message


Copyright © 2012. All Rights Reserved.