Class MetaDataImpl
java.lang.Object
ch.tocco.nice2.model.entity.impl.schema.meta.MetaDataImpl
- All Implemented Interfaces:
MetaData
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.model.entity.api.schema.MetaData
MetaData.ForeignKeyInfo, MetaData.IndexInfo
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMetaDataImpl
(String dsName, boolean isDefault, DataSource dataSource) MetaDataImpl
(String dsName, boolean isDefault, DataSource dataSource, Optional<Connection> conn) -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends V>
Tvoid
boolean
findColumns
(RelationModel relationModel) Finds the foreign key columns for the given 1:n relation model.forEntity
(EntityModel model) Finds a table corresponding to the given entity model.forRelation
(RelationModel relationModel) Finds the link table for the given n:m relation model.Finds a table with the given tablename.getForeignKeyInfo
(RelationModel model) Finds the foreign key information at the database for the given relation model.getForeignKeyInfo
(TableMetaData source, TableMetaData target) Returns all foreign key information from thesource
table that references primary or unique keys in thetarget
table.int
hashCode()
boolean
toString()
useConnection
(Connection conn) Use the given connection for all database accesses instead of obtaining new ones from the data source.
-
Field Details
-
values
-
-
Constructor Details
-
MetaDataImpl
public MetaDataImpl(String dsName, boolean isDefault, DataSource dataSource, Optional<Connection> conn) -
MetaDataImpl
-
-
Method Details
-
useConnection
Description copied from interface:MetaData
Use the given connection for all database accesses instead of obtaining new ones from the data source.- Specified by:
useConnection
in interfaceMetaData
-
getDataSourceName
- Specified by:
getDataSourceName
in interfaceMetaData
-
getDataSource
- Specified by:
getDataSource
in interfaceMetaData
-
getSchemaName
- Specified by:
getSchemaName
in interfaceMetaData
-
isDefault
public boolean isDefault() -
clearCache
public void clearCache()- Specified by:
clearCache
in interfaceMetaData
-
getTables
-
getForeignKeyInfo
public Iterable<MetaData.ForeignKeyInfo> getForeignKeyInfo(TableMetaData source, TableMetaData target) Description copied from interface:MetaData
Returns all foreign key information from thesource
table that references primary or unique keys in thetarget
table. Most often, this will contain one item or is empty, as there are usually not more than one reference from one table to another.- Specified by:
getForeignKeyInfo
in interfaceMetaData
-
getForeignKeyInfo
Description copied from interface:MetaData
Finds the foreign key information at the database for the given relation model. If this is a many-to-many relation, there are two foreign key infos returned, where the foreignkey is always the same link table and the primary key either the target or source table of the relation. If this is a many-to-one relation, there is only one foreign key info returned, where the foreign key is the one-side (source) of the relation and the primary key the many side (target).- Specified by:
getForeignKeyInfo
in interfaceMetaData
-
forEntity
Description copied from interface:MetaData
Finds a table corresponding to the given entity model. -
forTable
Description copied from interface:MetaData
Finds a table with the given tablename. -
forRelation
Description copied from interface:MetaData
Finds the link table for the given n:m relation model.- Specified by:
forRelation
in interfaceMetaData
-
findColumns
Description copied from interface:MetaData
Finds the foreign key columns for the given 1:n relation model.- Specified by:
findColumns
in interfaceMetaData
-
equals
-
hashCode
public int hashCode() -
toString
-
cachedGet
-