Package org.hibernate.cfg

Examples of org.hibernate.cfg.ObjectNameNormalizer


   */
  protected String determineGeneratorTableName(Properties params, Dialect dialect) {
    String name = ConfigurationHelper.getString( TABLE_PARAM, params, DEF_TABLE );
    boolean isGivenNameUnqualified = name.indexOf( '.' ) < 0;
    if ( isGivenNameUnqualified ) {
      ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
      name = normalizer.normalizeIdentifierQuoting( name );
      // if the given name is un-qualified we may neen to qualify it
      String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
      String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
      name = Table.qualify(
          dialect.quote( catalogName ),
          dialect.quote( schemaName ),
          dialect.quote( name)
      );
View Full Code Here


   * @param params The params supplied in the generator config (plus some standard useful extras).
   * @param dialect The dialect in effect
   * @return The name of the segment column
   */
  protected String determineSegmentColumnName(Properties params, Dialect dialect) {
    ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
    String name = ConfigurationHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN );
    return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
  }
View Full Code Here

   * @param params The params supplied in the generator config (plus some standard useful extras).
   * @param dialect The dialect in effect
   * @return The name of the value column
   */
  protected String determineValueColumnName(Properties params, Dialect dialect) {
    ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
    String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
    return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
  }
View Full Code Here

        }
    );
  }

  public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
    ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );

    tableName = normalizer.normalizeIdentifierQuoting( ConfigurationHelper.getString( ID_TABLE, params, DEFAULT_TABLE ) );
    if ( tableName.indexOf( '.' ) < 0 ) {
      tableName = dialect.quote( tableName );
      final String schemaName = dialect.quote(
          normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) )
      );
      final String catalogName = dialect.quote(
          normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) )
      );
      tableName = Table.qualify( catalogName, schemaName, tableName );
    }
    else {
      // if already qualified there is not much we can do in a portable manner so we pass it
      // through and assume the user has set up the name correctly.
    }

    pkColumnName = dialect.quote(
        normalizer.normalizeIdentifierQuoting(
            ConfigurationHelper.getString( PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN )
        )
    );
    valueColumnName = dialect.quote(
        normalizer.normalizeIdentifierQuoting(
            ConfigurationHelper.getString( VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN )
        )
    );
    keySize = ConfigurationHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH);
    String keyValue = ConfigurationHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE) );
View Full Code Here

   */
  protected String determineGeneratorTableName(Properties params, Dialect dialect) {
    String name = ConfigurationHelper.getString( TABLE_PARAM, params, DEF_TABLE );
    boolean isGivenNameUnqualified = name.indexOf( '.' ) < 0;
    if ( isGivenNameUnqualified ) {
      ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER );
      name = normalizer.normalizeIdentifierQuoting( name );
      // if the given name is un-qualified we may neen to qualify it
      String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
      String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
      name = Table.qualify(
          dialect.quote( catalogName ),
          dialect.quote( schemaName ),
          dialect.quote( name )
      );
View Full Code Here

   * @return The name of the segment column
   *
   * @see #getSegmentColumnName()
   */
  protected String determineSegmentColumnName(Properties params, Dialect dialect) {
    ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER );
    String name = ConfigurationHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN );
    return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
  }
View Full Code Here

   * @return The name of the value column
   *
   * @see #getValueColumnName()
   */
  protected String determineValueColumnName(Properties params, Dialect dialect) {
    ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER );
    String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
    return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
  }
View Full Code Here

    return sequenceName;
  }

  @Override
  public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
    ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
    sequenceName = normalizer.normalizeIdentifierQuoting(
        ConfigurationHelper.getString( SEQUENCE, params, "hibernate_sequence" )
    );
    parameters = params.getProperty( PARAMETERS );

    if ( sequenceName.indexOf( '.' ) < 0 ) {
      final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
      final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
      sequenceName = Table.qualify(
          dialect.quote( catalogName ),
          dialect.quote( schemaName ),
          dialect.quote( sequenceName )
      );
View Full Code Here

  }

  public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
    returnClass = type.getReturnedClass();

    ObjectNameNormalizer normalizer =
        ( ObjectNameNormalizer ) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER );

    String column = params.getProperty( "column" );
    if ( column == null ) {
      column = params.getProperty( PersistentIdentifierGenerator.PK );
    }
    column = dialect.quote( normalizer.normalizeIdentifierQuoting( column ) );

    String tableList = params.getProperty( "tables" );
    if ( tableList == null ) {
      tableList = params.getProperty( PersistentIdentifierGenerator.TABLES );
    }
    String[] tables = StringHelper.split( ", ", tableList );

    final String schema = dialect.quote(
        normalizer.normalizeIdentifierQuoting(
            params.getProperty( PersistentIdentifierGenerator.SCHEMA )
        )
    );
    final String catalog = dialect.quote(
        normalizer.normalizeIdentifierQuoting(
            params.getProperty( PersistentIdentifierGenerator.CATALOG )
        )
    );

    StringBuilder buf = new StringBuilder();
    for ( int i=0; i < tables.length; i++ ) {
      final String tableName = dialect.quote( normalizer.normalizeIdentifierQuoting( tables[i] ) );
      if ( tables.length > 1 ) {
        buf.append( "select max(" ).append( column ).append( ") as mx from " );
      }
      buf.append( Table.qualify( catalog, schema, tableName ) );
      if ( i < tables.length-1 ) {
View Full Code Here

  private String update;

  public void configure(Type type, Properties params, Dialect dialect) {
    identifierType = type;

    ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );

    tableName = ConfigurationHelper.getString( TABLE, params, DEFAULT_TABLE_NAME );
    if ( tableName.indexOf( '.' ) < 0 ) {
      final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
      final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
      tableName = Table.qualify(
          dialect.quote( catalogName ),
          dialect.quote( schemaName ),
          dialect.quote( tableName )
      );
    }
    else {
      // if already qualified there is not much we can do in a portable manner so we pass it
      // through and assume the user has set up the name correctly.
    }

    columnName = dialect.quote(
        normalizer.normalizeIdentifierQuoting(
            ConfigurationHelper.getString( COLUMN, params, DEFAULT_COLUMN_NAME )
        )
    );

    query = "select " +
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.ObjectNameNormalizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.