Example usage for org.hibernate.mapping Constraint getTable

List of usage examples for org.hibernate.mapping Constraint getTable

Introduction

In this page you can find the example usage for org.hibernate.mapping Constraint getTable.

Prototype

public Table getTable() 

Source Link

Usage

From source file:com.github.gekoh.yagen.api.DefaultNamingStrategy.java

License:Apache License

@Override
public String constraintName(Constraint constraint, String entityClass) {
    String name = constraint.getName();

    if (constraint instanceof ForeignKey || constraint instanceof UniqueKey) {
        StringBuilder colList = new StringBuilder();

        for (org.hibernate.mapping.Column column : (Iterable<? extends org.hibernate.mapping.Column>) constraint
                .getColumns()) {/*from   w w w .ja  va2 s .  c om*/
            if (colList.length() > 0) {
                colList.append(", ");
            }
            colList.append(column.getName().toLowerCase());
        }

        name = beautifyConstraintName(name, entityClass, tableName(constraint.getTable().getName()),
                concatColumnNames(colList.toString()));
    }

    return constraintName(name);
}