package org.hibernate.mapping;
import java.util.HashMap;
import java.util.Map;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.Mapping;
import org.hibernate.internal.util.StringHelper;
public class UniqueKey extends Constraint {
private java.util.Map<Column, String> columnOrderMap = new HashMap<Column, String>();
@Override
public String sqlConstraintString(
Dialect dialect,
String constraintName,
String defaultCatalog,
String defaultSchema) {
return "";
}
@Override
public String sqlCreateString(
Dialect dialect,
Mapping p,
String defaultCatalog,
String defaultSchema) {
return null;
}
@Override
public String sqlDropString(
Dialect dialect,
String defaultCatalog,
String defaultSchema) {
return null;
}
public void addColumn(Column column, String order) {
addColumn( column );
if ( StringHelper.isNotEmpty( order ) ) {
columnOrderMap.put( column, order );
}
}
public Map<Column, String> getColumnOrderMap() {
return columnOrderMap;
}
public String generatedConstraintNamePrefix() {
return "UK_";
}
@Override
public String getExportIdentifier() {
return StringHelper.qualify( getTable().getName(), "UK-" + getName() );
}
}