Example usage for org.hibernate.boot.model.naming ImplicitBasicColumnNameSource getAttributePath

List of usage examples for org.hibernate.boot.model.naming ImplicitBasicColumnNameSource getAttributePath

Introduction

In this page you can find the example usage for org.hibernate.boot.model.naming ImplicitBasicColumnNameSource getAttributePath.

Prototype

public AttributePath getAttributePath();

Source Link

Document

Access to the AttributePath for the basic value

Usage

From source file:com.evolveum.midpoint.repo.sql.util.MidPointImplicitNamingStrategy.java

License:Apache License

@Override
public Identifier determineBasicColumnName(ImplicitBasicColumnNameSource source) {
    String columnName = source.getAttributePath().getProperty();
    String fullPath = source.getAttributePath().getFullPath();

    String result;//from w ww  . j  av  a  2s .  c om
    if (fullPath.startsWith("credentials.") || fullPath.startsWith("activation.")) {
        //credentials and activation are embedded and doesn't need to be qualified

        return super.determineBasicColumnName(source);
    } else {
        if (fullPath.contains("&&")) {
            // it's collection
            result = columnName;
        } else {
            result = fullPath.replaceAll("\\.", "_");
        }
    }
    result = RUtil.fixDBSchemaObjectNameLength(result);

    Identifier i = toIdentifier(result, source.getBuildingContext());

    LOGGER.trace("determineBasicColumnName {} {}", fullPath, i);

    return i;
}