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) getIndexes returns the list of indexes for a table.getTableNames
(DatabaseMetaData metaData) Gets the names of the existing tables in the DBboolean
isTablePresent
(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:DatabaseMetaDataReader
Checks if the table corresponding to given type exists in the database.- Specified by:
isTablePresent
in 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:DatabaseMetaDataReader
Gets the names of the existing tables in the DB- Specified by:
getTableNames
in interfaceDatabaseMetaDataReader
- Parameters:
metaData
- the meta data from which to extract the table names- Returns:
- an
Iterable
of table names asstrings
-
getFields
- Specified by:
getFields
in interfaceDatabaseMetaDataReader
- Returns:
-
getIndexes
getIndexes returns the list of indexes for a table. Unique indexes with only one field are treated as unique fields, so they are not returned by this method. Indexes created by primary key constraints are not returned either, to preserve backwards compatibility- Specified by:
getIndexes
in interfaceDatabaseMetaDataReader
- Parameters:
databaseMetaData
- the database metadata to read the information fromtableName
- the name of the table from which to read the indexes- Returns:
- the list of indexes
-
getForeignKeys
Description copied from interface:DatabaseMetaDataReader
Gets the list of foreign keys for a given table- Specified by:
getForeignKeys
in 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
Iterable
of foreign keys
-