List of usage examples for org.hibernate.mapping Constraint getName
public String getName()
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()) {/* w w w .ja v a2 s.co m*/ 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); }
From source file:com.github.gekoh.yagen.hibernate.PatchGlue.java
License:Apache License
public static String afterConstraintSqlCreateString(Table table, Dialect dialect, String returnValue, Constraint constraint) { if (returnValue == null) { return null; }/* w w w . j ava2 s . c om*/ StringBuffer buf = new StringBuffer(returnValue); CreateDDL ddlEnhancer = getDDLEnhancerFromDialect(dialect); if (ddlEnhancer == null) { return returnValue; } return ddlEnhancer.updateCreateConstraint(dialect, buf, constraint.getName(), table, constraint); }