Example usage for org.hibernate.boot.model.relational QualifiedNameParser INSTANCE

List of usage examples for org.hibernate.boot.model.relational QualifiedNameParser INSTANCE

Introduction

In this page you can find the example usage for org.hibernate.boot.model.relational QualifiedNameParser INSTANCE.

Prototype

QualifiedNameParser INSTANCE

To view the source code for org.hibernate.boot.model.relational QualifiedNameParser INSTANCE.

Click Source Link

Document

Singleton access

Usage

From source file:net.e6tech.elements.persist.hibernate.ModifiedTableGenerator.java

License:Apache License

/**
 * Determine the table name to use for the generator values.
 *
 * Called during {@link #configure configuration}.
 *
 * @see #getTableName()/*from  ww w . j a va 2  s . c  o m*/
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @param jdbcEnvironment The JDBC environment
 * @return The table name to use.
 */
@SuppressWarnings("UnusedParameters")
protected QualifiedName determineGeneratorTableName(Properties params, JdbcEnvironment jdbcEnvironment) {
    final String tableName = ConfigurationHelper.getString(TABLE_PARAM, params, DEF_TABLE);

    if (tableName.contains(".")) {
        return QualifiedNameParser.INSTANCE.parse(tableName);
    } else {
        // todo : need to incorporate implicit catalog and schema names
        final Identifier catalog = jdbcEnvironment.getIdentifierHelper()
                .toIdentifier(ConfigurationHelper.getString(CATALOG, params));
        final Identifier schema = jdbcEnvironment.getIdentifierHelper()
                .toIdentifier(ConfigurationHelper.getString(SCHEMA, params));
        return new QualifiedNameParser.NameParts(catalog, schema,
                jdbcEnvironment.getIdentifierHelper().toIdentifier(tableName));
    }
}

From source file:net.e6tech.elements.persist.hibernate.TableIdGenerator.java

License:Apache License

@Override
protected QualifiedName determineGeneratorTableName(Properties params, JdbcEnvironment jdbcEnvironment) {
    final String tableName = ConfigurationHelper.getString(TABLE_PARAM, params, defaultTableName);

    if (tableName.contains(".")) {
        return QualifiedNameParser.INSTANCE.parse(tableName);
    } else {//from  ww  w .j ava 2 s .c o m
        final Identifier catalog = jdbcEnvironment.getIdentifierHelper()
                .toIdentifier(ConfigurationHelper.getString(CATALOG, params));
        final Identifier schema = jdbcEnvironment.getIdentifierHelper()
                .toIdentifier(ConfigurationHelper.getString(SCHEMA, params));
        return new QualifiedNameParser.NameParts(catalog, schema,
                jdbcEnvironment.getIdentifierHelper().toIdentifier(tableName));
    }
}