org.jpox.store.rdbms.table
Class ColumnCreator

java.lang.Object
  extended byorg.jpox.store.rdbms.table.ColumnCreator

public final class ColumnCreator
extends java.lang.Object

Helper class to create columns. Takes the definition provided and adds columns to the associated table.

Version:
$Revision: 1.64 $

Field Summary
protected static Localiser LOCALISER
          Localiser for messages.
 
Method Summary
static DatastoreField createAdapterColumn(JavaTypeMapping adapterMapping, StoreManager storeMgr, ClassLoaderResolver clr, DatastoreContainerObject table, ColumnMetaData colmd, boolean pk)
          Convenience method to add the column for an adapter primary-key mapping.
static void createColumnsForFieldUsingReference(JavaTypeMapping mapping, DatastoreContainerObject table, AbstractPropertyMetaData fmd, ClassLoaderResolver clr, boolean embedded)
          Create columns for reference (Object/interface) fields.
static void createColumnsForFieldUsingSubclassTable(JavaTypeMapping mapping, DatastoreContainerObject table, AbstractPropertyMetaData fmd, ClassLoaderResolver clr)
          Create columns for a field that uses subclass-table inheritance and where we want to have a FK for each subclass with its own table.
static JavaTypeMapping createColumnsForJoinTables(java.lang.Class javaType, AbstractPropertyMetaData fmd, ColumnMetaData[] columnMetaData, StoreManager storeMgr, DatastoreContainerObject table, boolean primaryKey, boolean nullable, boolean serialised, boolean embedded, DatastoreFieldRole role, ClassLoaderResolver clr, JavaTypeMapping adapterColumnMapping, boolean adapterColumnMandatory)
          Method to create the required columns (and mapping if necessary) for a field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages.

Method Detail

createAdapterColumn

public static DatastoreField createAdapterColumn(JavaTypeMapping adapterMapping,
                                                 StoreManager storeMgr,
                                                 ClassLoaderResolver clr,
                                                 DatastoreContainerObject table,
                                                 ColumnMetaData colmd,
                                                 boolean pk)
Convenience method to add the column for an adapter primary-key mapping.

Parameters:
adapterMapping - The adapter mapping
storeMgr - Manager for the store
clr - ClassLoaderResolver
table - Table where we create the column
colmd - The column MetaData
pk - Whether this column is (part of) the PK.
Returns:
The added column

createColumnsForJoinTables

public static JavaTypeMapping createColumnsForJoinTables(java.lang.Class javaType,
                                                         AbstractPropertyMetaData fmd,
                                                         ColumnMetaData[] columnMetaData,
                                                         StoreManager storeMgr,
                                                         DatastoreContainerObject table,
                                                         boolean primaryKey,
                                                         boolean nullable,
                                                         boolean serialised,
                                                         boolean embedded,
                                                         DatastoreFieldRole role,
                                                         ClassLoaderResolver clr,
                                                         JavaTypeMapping adapterColumnMapping,
                                                         boolean adapterColumnMandatory)
Method to create the required columns (and mapping if necessary) for a field

Parameters:
javaType - The java type of the field
fmd - Metadata for the field
columnMetaData - MetaData defining the columns
storeMgr - Store Manager
table - The table to add the mapping to
primaryKey - Whether this field is the PK
nullable - Whether this field is to be nullable
serialised - Whether the field is serialised
embedded - Whether the field is embedded
role - The role of this field (if any)
clr - ClassLoader resolver
adapterColumnMapping - Mapping for an adapter column (optional)
adapterColumnMandatory - Whether the adapter column column is mandatory
Returns:
The java type mapping for this field

createColumnsForFieldUsingSubclassTable

public static void createColumnsForFieldUsingSubclassTable(JavaTypeMapping mapping,
                                                           DatastoreContainerObject table,
                                                           AbstractPropertyMetaData fmd,
                                                           ClassLoaderResolver clr)
Create columns for a field that uses subclass-table inheritance and where we want to have a FK for each subclass with its own table.

Parameters:
mapping - the mapping for the field
table - the Table which will hold the columns
fmd - MetaData for the field
clr - The ClassLoaderResolver

createColumnsForFieldUsingReference

public static void createColumnsForFieldUsingReference(JavaTypeMapping mapping,
                                                       DatastoreContainerObject table,
                                                       AbstractPropertyMetaData fmd,
                                                       ClassLoaderResolver clr,
                                                       boolean embedded)
Create columns for reference (Object/interface) fields.

Parameters:
mapping - the mapping for the field
table - the Table which will hold the columns
fmd - MetaData for the field
clr - The ClassLoaderResolver
embedded - Whether the field is embedded


Copyright © -2007 . All Rights Reserved.