Package org.hibernate.cfg

Examples of org.hibernate.cfg.ObjectNameNormalizer$NamingStrategyHelper


    String sequencePerEntitySuffix = ConfigurationHelper.getString( CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, DEF_SEQUENCE_SUFFIX );
    // JPA_ENTITY_NAME value honors <class ... entity-name="..."> (HBM) and @Entity#name (JPA) overrides.
    String sequenceName = ConfigurationHelper.getBoolean( CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false )
        ? params.getProperty( JPA_ENTITY_NAME ) + sequencePerEntitySuffix
        : DEF_SEQUENCE_NAME;
    ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
    sequenceName = ConfigurationHelper.getString( SEQUENCE_PARAM, params, sequenceName );
    if ( sequenceName.indexOf( '.' ) < 0 ) {
      sequenceName = normalizer.normalizeIdentifierQuoting( sequenceName );
      String schemaName = params.getProperty( SCHEMA );
      String catalogName = params.getProperty( CATALOG );
      sequenceName = Table.qualify(
          dialect.quote( catalogName ),
          dialect.quote( schemaName ),
View Full Code Here


    Properties properties = new Properties();
    properties.setProperty( SequenceGenerator.SEQUENCE, TEST_SEQUENCE );
    properties.setProperty( SequenceHiLoGenerator.MAX_LO, "3" );
    properties.put(
        PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
        new ObjectNameNormalizer() {
          @Override
          protected boolean isUseQuotedIdentifiersGlobally() {
            return false;
          }
View Full Code Here

    properties.setProperty( TableHiLoGenerator.TABLE, GEN_TABLE );
    properties.setProperty( TableHiLoGenerator.COLUMN, GEN_COLUMN );
    properties.setProperty( TableHiLoGenerator.MAX_LO, "3" );
    properties.put(
        PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
        new ObjectNameNormalizer() {
          @Override
          protected boolean isUseQuotedIdentifiersGlobally() {
            return false;
          }
View Full Code Here

    Properties properties = new Properties();
    properties.setProperty( SequenceGenerator.SEQUENCE, TEST_SEQUENCE );
    properties.setProperty( SequenceHiLoGenerator.MAX_LO, "0" ); // JPA allocationSize of 1
    properties.put(
        PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
        new ObjectNameNormalizer() {
          @Override
          protected boolean isUseQuotedIdentifiersGlobally() {
            return false;
          }
View Full Code Here

  private Properties buildGeneratorPropertiesBase() {
    Properties props = new Properties();
    props.put(
        PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
        new ObjectNameNormalizer() {
          protected boolean isUseQuotedIdentifiersGlobally() {
            return false;
          }

          protected NamingStrategy getNamingStrategy() {
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 Type getIdentifierType() {
    return identifierType;
  }

  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 )
        )
    );

    StringBuffer buf = new StringBuffer();
    for ( int i=0; i < tables.length; i++ ) {
      final String tableName = dialect.quote( normalizer.normalizeIdentifierQuoting( tables[i] ) );
      if ( tables.length > 1 ) {
        buf.append( "select " ).append( column ).append( " 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

   * @param params The params supplied in the generator config (plus some standard useful extras).
   * @param dialect The dialect in effect
   * @return The sequence name
   */
  protected String determineSequenceName(Properties params, Dialect dialect) {
    ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
    String sequenceName = ConfigurationHelper.getString( SEQUENCE_PARAM, params, DEF_SEQUENCE_NAME );
    if ( sequenceName.indexOf( '.' ) < 0 ) {
      sequenceName = normalizer.normalizeIdentifierQuoting( sequenceName );
      String schemaName = params.getProperty( SCHEMA );
      String catalogName = params.getProperty( CATALOG );
      sequenceName = Table.qualify(
          dialect.quote( catalogName ),
          dialect.quote( schemaName ),
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.ObjectNameNormalizer$NamingStrategyHelper

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.