Search in sources :

Example 1 with ColumnReferenceMapping

use of org.hibernate.tool.schema.extract.spi.ForeignKeyInformation.ColumnReferenceMapping in project hibernate-orm by hibernate.

the class CheckForExistingForeignKeyTest method getForeignKeyInformation.

/**
 * @param referencedTableName - String
 * @param referencingColumnName - String
 * @param keyName - String
 * @return ForeignKeyInformation
 */
private ForeignKeyInformation getForeignKeyInformation(String referencedTableName, String referencingColumnName, String keyName) {
    List<ColumnReferenceMapping> columnMappingList = new ArrayList<>();
    ColumnInformation referencingColumnMetadata = getColumnInformation("-", referencingColumnName);
    ColumnInformation referencedColumnMetadata = getColumnInformation(referencedTableName, "-");
    ColumnReferenceMapping columnReferenceMapping = new ColumnReferenceMappingImpl(referencingColumnMetadata, referencedColumnMetadata);
    columnMappingList.add(columnReferenceMapping);
    ForeignKeyInformationImpl foreignKeyInformation = new ForeignKeyInformationImpl(new Identifier(keyName, false), columnMappingList);
    return foreignKeyInformation;
}
Also used : Identifier(org.hibernate.boot.model.naming.Identifier) ForeignKeyInformationImpl(org.hibernate.tool.schema.extract.internal.ForeignKeyInformationImpl) ColumnInformation(org.hibernate.tool.schema.extract.spi.ColumnInformation) ArrayList(java.util.ArrayList) ColumnReferenceMapping(org.hibernate.tool.schema.extract.spi.ForeignKeyInformation.ColumnReferenceMapping)

Aggregations

ArrayList (java.util.ArrayList)1 Identifier (org.hibernate.boot.model.naming.Identifier)1 ForeignKeyInformationImpl (org.hibernate.tool.schema.extract.internal.ForeignKeyInformationImpl)1 ColumnInformation (org.hibernate.tool.schema.extract.spi.ColumnInformation)1 ColumnReferenceMapping (org.hibernate.tool.schema.extract.spi.ForeignKeyInformation.ColumnReferenceMapping)1