public class SynchroDatabaseMetadata extends Object
Modifier and Type | Field and Description |
---|---|
protected Configuration |
configuration |
protected SynchroContext |
context |
protected DatabaseMetadata |
delegate |
protected Dialect |
dialect |
protected List<SynchroInterceptor> |
interceptors |
protected DatabaseMetaData |
meta |
protected Set<String> |
sequences |
protected Map<String,SynchroTableMetadata> |
tables |
protected String[] |
types |
Constructor and Description |
---|
SynchroDatabaseMetadata(Connection connection,
Dialect dialect,
Configuration configuration,
SynchroContext context) |
Modifier and Type | Method and Description |
---|---|
protected void |
fireOnTableLoad(SynchroTableMetadata table) |
SynchroContext |
getContext() |
Dialect |
getDialect() |
ResultSet |
getExportedKeys(String catalog,
String schema,
String table) |
ResultSet |
getImportedKeys(String catalog,
String schema,
String table) |
int |
getInExpressionCountLimit() |
protected List<SynchroInterceptor> |
getInterceptors(TableMetadata table) |
Set<String> |
getLoadedRootTableNames()
Return all root tables (top level tables).
|
SynchroTableMetadata |
getLoadedTable(String name) |
SynchroTableMetadata |
getLoadedTable(String name,
String schema,
String catalog) |
Set<String> |
getLoadedTableNames()
Return all tables (already loaded).
|
ResultSet |
getPrimaryKeys(String catalog,
String schema,
String table) |
protected SynchroTableMetadata |
getTable(Dialect dialect,
String name,
String schema,
String catalog,
boolean isQuoted,
Predicate<SynchroColumnMetadata> columnFilter,
boolean withJoinedTables) |
SynchroTableMetadata |
getTable(String name) |
int |
getTableCount() |
Set<String> |
getTableNames(Predicate<String> tableFilter)
Load tables names from database schema, using the given table filter.
|
Set<String> |
getTableNames(Set<String> tablePatterns,
Predicate<String> tableFilter)
Load tables names from database schema, using the given table patterns list, and a optional filter.
|
protected Set<String> |
initSequences(Connection connection,
Dialect dialect) |
boolean |
isSequence(String tableName) |
static SynchroDatabaseMetadata |
loadDatabaseMetadata(Connection connection,
Dialect dialect,
Configuration configuration,
SynchroContext context,
Set<String> tableNames,
boolean enableJoinMetadataLoading)
Load the datasource schema for the given connection and dialect.
|
static SynchroDatabaseMetadata |
loadDatabaseMetadata(Connection connection,
Dialect dialect,
Configuration configuration,
SynchroContext context,
Set<String> tableNames,
Predicate<String> tableFilter,
Predicate<SynchroColumnMetadata> columnFilter,
boolean enableJoinMetadataLoading)
Load the datasource schema for the given connection and dialect.
|
void |
prepare(Dialect dialect,
Configuration configuration,
Set<String> tableNames,
Predicate<String> tableFilter,
Predicate<SynchroColumnMetadata> columnFilter,
boolean enableJoinMetadataLoading) |
protected final DatabaseMetadata delegate
protected final Map<String,SynchroTableMetadata> tables
protected final DatabaseMetaData meta
protected final Configuration configuration
protected final Dialect dialect
protected List<SynchroInterceptor> interceptors
protected SynchroContext context
public SynchroDatabaseMetadata(Connection connection, Dialect dialect, Configuration configuration, SynchroContext context)
public static SynchroDatabaseMetadata loadDatabaseMetadata(Connection connection, Dialect dialect, Configuration configuration, SynchroContext context, Set<String> tableNames, boolean enableJoinMetadataLoading)
connection
- connection of the data sourcedialect
- dialect to useconfiguration
- tableNames
- table names to includes (table patterns are accepted)public static SynchroDatabaseMetadata loadDatabaseMetadata(Connection connection, Dialect dialect, Configuration configuration, SynchroContext context, Set<String> tableNames, Predicate<String> tableFilter, Predicate<SynchroColumnMetadata> columnFilter, boolean enableJoinMetadataLoading)
connection
- connection of the data sourcedialect
- dialect to useconfiguration
- tableNames
- table names to includes (table patterns are accepted) (optional if tabkleFilter not null)tableFilter
- filter tables (optional)columnFilter
- filter columns (optional)public int getTableCount()
public SynchroContext getContext()
public Dialect getDialect()
public int getInExpressionCountLimit()
public boolean isSequence(String tableName)
public void prepare(Dialect dialect, Configuration configuration, Set<String> tableNames, Predicate<String> tableFilter, Predicate<SynchroColumnMetadata> columnFilter, boolean enableJoinMetadataLoading)
public SynchroTableMetadata getTable(String name) throws HibernateException
HibernateException
public SynchroTableMetadata getLoadedTable(String name) throws HibernateException
HibernateException
public SynchroTableMetadata getLoadedTable(String name, String schema, String catalog) throws HibernateException
HibernateException
public Set<String> getTableNames(Predicate<String> tableFilter)
#getTableNames(Set,Predicate)
with the table pattern "%".tableFilter
- A filter predicate, to filter tables to retrieve. If null: process all tables found.#getTableNames(Set,Predicate)
public Set<String> getTableNames(Set<String> tablePatterns, Predicate<String> tableFilter)
org.hibernate.cfg.AvailableSettings.ENABLE_SYNONYMS
.tablePatterns
- A list of table pattern. Use the pattern '%' to get all tables.tableFilter
- Optional. A filter predicate, to filter tables to retrieve. If null: process tables found from pattern
will be return.org.hibernate.cfg.AvailableSettings.ENABLE_SYNONYMS
,
DatabaseMetaData.getTables(String,String,String,String[])
public Set<String> getLoadedRootTableNames()
public Set<String> getLoadedTableNames()
public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException
SQLException
java.sql.DatabaseMetaData.getExportedKeys(String,String,String)
public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException
SQLException
java.sql.DatabaseMetaData.getImportedKeys(String,String,String)
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException
SQLException
java.sql.DatabaseMetaData.getPrimaryKeys(String,String,String)
protected SynchroTableMetadata getTable(Dialect dialect, String name, String schema, String catalog, boolean isQuoted, Predicate<SynchroColumnMetadata> columnFilter, boolean withJoinedTables) throws HibernateException
HibernateException
protected Set<String> initSequences(Connection connection, Dialect dialect) throws SQLException
SQLException
protected List<SynchroInterceptor> getInterceptors(TableMetadata table)
protected void fireOnTableLoad(SynchroTableMetadata table)
Copyright © 2012–2014 IFREMER. All rights reserved.