Package net.java.ao.schema.helper
Class DatabaseMetaDataReaderImpl
java.lang.Object
net.java.ao.schema.helper.DatabaseMetaDataReaderImpl
- All Implemented Interfaces:
DatabaseMetaDataReader
-
Constructor Summary
ConstructorsConstructorDescriptionDatabaseMetaDataReaderImpl(DatabaseProvider databaseProvider, NameConverters nameConverters, SchemaConfiguration schemaConfiguration) -
Method Summary
Modifier and TypeMethodDescriptiongetFields(DatabaseMetaData databaseMetaData, String tableName) getForeignKeys(DatabaseMetaData metaData, String tableName) Gets the list of foreign keys for a given tablegetIndexes(DatabaseMetaData databaseMetaData, String tableName) Gets the list of simple indexes for a given table.getTableNames(DatabaseMetaData metaData) Gets the names of the existing tables in the DBbooleanisTablePresent(DatabaseMetaData databaseMetaData, Class<? extends RawEntity<?>> type) Checks if the table corresponding to given type exists in the database.
-
Constructor Details
-
DatabaseMetaDataReaderImpl
public DatabaseMetaDataReaderImpl(DatabaseProvider databaseProvider, NameConverters nameConverters, SchemaConfiguration schemaConfiguration)
-
-
Method Details
-
isTablePresent
public boolean isTablePresent(DatabaseMetaData databaseMetaData, Class<? extends RawEntity<?>> type) Description copied from interface:DatabaseMetaDataReaderChecks if the table corresponding to given type exists in the database.- Specified by:
isTablePresentin interfaceDatabaseMetaDataReader- Parameters:
databaseMetaData- of the database to be checkedtype- to check against- Returns:
- true if the table exists, false otherwise
-
getTableNames
Description copied from interface:DatabaseMetaDataReaderGets the names of the existing tables in the DB- Specified by:
getTableNamesin interfaceDatabaseMetaDataReader- Parameters:
metaData- the meta data from which to extract the table names- Returns:
- an
Iterableof table names asstrings
-
getFields
- Specified by:
getFieldsin interfaceDatabaseMetaDataReader- Returns:
-
getIndexes
Description copied from interface:DatabaseMetaDataReaderGets the list of simple indexes for a given table. AO only supports single column indexes, and as such composite indexes will not be returned by this method even if they exist in the table. Prior to AO v1.1.4 this method returned fragments of composite indexes and it was then possible for the migration code to crash because it would try to delete the same index multiple times.- Specified by:
getIndexesin interfaceDatabaseMetaDataReader- Parameters:
databaseMetaData- the database metadata to read the information fromtableName- the name of the table from which to read the indexes- Returns:
- an
Iterableof simple indexes
-
getForeignKeys
Description copied from interface:DatabaseMetaDataReaderGets the list of foreign keys for a given table- Specified by:
getForeignKeysin interfaceDatabaseMetaDataReader- Parameters:
metaData- the database metadata to read the information fromtableName- the name of the table from which to read the foreign keys- Returns:
- an
Iterableof foreign keys
-