org.ujorm.orm.metaModel
Class MetaDbServiceEx

java.lang.Object
  extended by org.ujorm.orm.metaModel.MetaDbService
      extended by org.ujorm.orm.metaModel.MetaDbServiceEx

public class MetaDbServiceEx
extends MetaDbService

A service method for the MetaDatabase class. The service class can be overwritten

See Also:
MetaParams.META_DB_SERVICE

Field Summary
static String COLUMN_DEF_CHAR_LENGTH
           
static String COLUMN_DEF_DEFAULT_VALUE
           
static String COLUMN_DEF_NAME
           
static String COLUMN_DEF_NULLABLE
           
static String COLUMN_DEF_VALUE_CONSTRAINTS
           
static boolean DEFAULT_VALUES_IN_DB_ALLOWED
          Specifies if default values in DB are allowed.
static String FKEY_DEF_NAME
           
static String PKEY_DEF_COLUMN_NAME
           
static String PKEY_DEF_NAME
           
 
Fields inherited from class org.ujorm.orm.metaModel.MetaDbService
anyChange, db, sql, stat
 
Constructor Summary
MetaDbServiceEx()
           
 
Method Summary
 void checkDBStructure(Session session, boolean repairDB)
           
 void checkKeywords(Connection conn, List<MetaTable> tables, List<MetaColumn> columns, List<MetaIndex> indexes)
           
 List<String> checkTableForColumnsProperties(Connection conn, MetaTable mappedTable, boolean repairDB)
           
 List<String> checkTableForForeignKeys(Connection conn, MetaTable mappedTable, boolean repairDB)
           
 List<String> checkTableForIndexes(Connection conn, MetaTable mappedTable, boolean repairDB)
           
 List<String> checkTableForMissingColumns(Connection conn, MetaTable mappedTable, boolean repairDB)
           
 List<String> checkTableForPrimaryKeys(Connection conn, MetaTable mappedTable, boolean repairDB)
           
 MetaIndex createIndexForColumn(String idxName, MetaColumn column, MetaTable metaTable)
          Create an Index For the Column.
 String createIndexNameForColumn(MetaColumn column, boolean uniqueIndex, MetaTable metaTable)
          Create an Index For the Column.
 Map<String,Map<String,Object>> listDBTableColumns(MetaTable table, DatabaseMetaData dmd)
           
 Map<String,Map<String,Object>> listDBTableFKey(MetaTable table, DatabaseMetaData dmd)
           
 Set<String> listDBTableIndexes(MetaTable table, DatabaseMetaData dmd, List<MetaColumn> skippedPrimaryKeyColumns)
           
 Map<String,Map<String,Object>> listDBTablePKey(MetaTable table, DatabaseMetaData dmd)
           
 
Methods inherited from class org.ujorm.orm.metaModel.MetaDbService
changeIndex, checkKeyWord, checkReportKeywords, create, createForeignKey, createNewColumn, createSchema, createSequenceTable, createTable, createTableComments, createTableComments, dbIdentifier, executeUpdate, findFirstSequencer, getDialect, getDialectEx, getSql, initialize, isAnyChange, isCatalog, isModelChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VALUES_IN_DB_ALLOWED

public static boolean DEFAULT_VALUES_IN_DB_ALLOWED
Specifies if default values in DB are allowed. There are many problems with default value constraints in MSSQL, therefore it's recommended to not use them. Ujorm provides own mechanism to deal with default values and INSERTs and UPDATEs contains default values explicitly.


COLUMN_DEF_DEFAULT_VALUE

public static final String COLUMN_DEF_DEFAULT_VALUE
See Also:
Constant Field Values

COLUMN_DEF_NAME

public static final String COLUMN_DEF_NAME
See Also:
Constant Field Values

COLUMN_DEF_NULLABLE

public static final String COLUMN_DEF_NULLABLE
See Also:
Constant Field Values

COLUMN_DEF_CHAR_LENGTH

public static final String COLUMN_DEF_CHAR_LENGTH
See Also:
Constant Field Values

COLUMN_DEF_VALUE_CONSTRAINTS

public static final String COLUMN_DEF_VALUE_CONSTRAINTS
See Also:
Constant Field Values

PKEY_DEF_NAME

public static final String PKEY_DEF_NAME
See Also:
Constant Field Values

PKEY_DEF_COLUMN_NAME

public static final String PKEY_DEF_COLUMN_NAME
See Also:
Constant Field Values

FKEY_DEF_NAME

public static final String FKEY_DEF_NAME
See Also:
Constant Field Values
Constructor Detail

MetaDbServiceEx

public MetaDbServiceEx()
Method Detail

checkDBStructure

public void checkDBStructure(Session session,
                             boolean repairDB)
                      throws Exception
Throws:
Exception

checkKeywords

public void checkKeywords(Connection conn,
                          List<MetaTable> tables,
                          List<MetaColumn> columns,
                          List<MetaIndex> indexes)
                   throws Exception
Throws:
Exception

checkTableForMissingColumns

public List<String> checkTableForMissingColumns(Connection conn,
                                                MetaTable mappedTable,
                                                boolean repairDB)
                                         throws Exception
Throws:
Exception

checkTableForColumnsProperties

public List<String> checkTableForColumnsProperties(Connection conn,
                                                   MetaTable mappedTable,
                                                   boolean repairDB)
                                            throws Exception
Throws:
Exception

checkTableForPrimaryKeys

public List<String> checkTableForPrimaryKeys(Connection conn,
                                             MetaTable mappedTable,
                                             boolean repairDB)
                                      throws Exception
Throws:
Exception

checkTableForForeignKeys

public List<String> checkTableForForeignKeys(Connection conn,
                                             MetaTable mappedTable,
                                             boolean repairDB)
                                      throws Exception
Throws:
Exception

checkTableForIndexes

public List<String> checkTableForIndexes(Connection conn,
                                         MetaTable mappedTable,
                                         boolean repairDB)
                                  throws Exception
Throws:
Exception

listDBTableColumns

public Map<String,Map<String,Object>> listDBTableColumns(MetaTable table,
                                                         DatabaseMetaData dmd)
                                                  throws SQLException
Throws:
SQLException

listDBTablePKey

public Map<String,Map<String,Object>> listDBTablePKey(MetaTable table,
                                                      DatabaseMetaData dmd)
                                               throws SQLException
Throws:
SQLException

listDBTableFKey

public Map<String,Map<String,Object>> listDBTableFKey(MetaTable table,
                                                      DatabaseMetaData dmd)
                                               throws SQLException
Throws:
SQLException

listDBTableIndexes

public Set<String> listDBTableIndexes(MetaTable table,
                                      DatabaseMetaData dmd,
                                      List<MetaColumn> skippedPrimaryKeyColumns)
                               throws SQLException
Throws:
SQLException

createIndexForColumn

public MetaIndex createIndexForColumn(String idxName,
                                      MetaColumn column,
                                      MetaTable metaTable)
Create an Index For the Column. The method is called from the MetaDbServiceEx class


createIndexNameForColumn

public String createIndexNameForColumn(MetaColumn column,
                                       boolean uniqueIndex,
                                       MetaTable metaTable)
Create an Index For the Column. The method is called from the MetaDbServiceEx class



Copyright 2013, Pavel Ponec