Package org.hibernate.engine.jdbc.spi

Examples of org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData


    settings.setSessionFactoryName(sessionFactoryName);

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
    }
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
    }
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) {
      batchSize = 0;
    }
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch size: %s", batchSize );
    }
    settings.setJdbcBatchSize(batchSize);

    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
    }
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
        Environment.USE_SCROLLABLE_RESULTSET,
        properties,
        meta.supportsScrollableResults()
    );
    if ( debugEnabled ) {
      LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
    }
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    if ( debugEnabled ) {
      LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
    }
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
    if ( debugEnabled ) {
      LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
    }
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
View Full Code Here


    if ( parameterStrategy == ParameterStrategy.POSITIONAL ) {
      throw new QueryException( "Cannot mix named and positional parameters" );
    }
    if ( parameterStrategy == ParameterStrategy.UNKNOWN ) {
      // protect to only do this check once
      final ExtractedDatabaseMetaData databaseMetaData = getSession().getTransactionCoordinator()
          .getJdbcCoordinator()
          .getLogicalConnection()
          .getJdbcServices()
          .getExtractedMetaDataSupport();
      if ( ! databaseMetaData.supportsNamedParameters() ) {
        LOG.unsupportedNamedParameters();
      }
      parameterStrategy = ParameterStrategy.NAMED;
    }
  }
View Full Code Here

    );

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    MultiTableBulkIdStrategy multiTableBulkIdStrategy = strategySelector.resolveStrategy(
        MultiTableBulkIdStrategy.class,
        properties.getProperty( AvailableSettings.HQL_BULK_ID_STRATEGY )
    );
    if ( multiTableBulkIdStrategy == null ) {
      multiTableBulkIdStrategy = jdbcServices.getDialect().supportsTemporaryTables()
          ? TemporaryTableBulkIdStrategy.INSTANCE
          : new PersistentTableBulkIdStrategy();
    }
    settings.setMultiTableBulkIdStrategy( multiTableBulkIdStrategy );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(AvailableSettings.FLUSH_BEFORE_COMPLETION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
    }
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(AvailableSettings.AUTO_CLOSE_SESSION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
    }
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(AvailableSettings.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) {
      batchSize = 0;
    }
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch size: %s", batchSize );
    }
    settings.setJdbcBatchSize(batchSize);

    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(AvailableSettings.BATCH_VERSIONED_DATA, properties, false);
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
    }
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
        AvailableSettings.USE_SCROLLABLE_RESULTSET,
        properties,
        meta.supportsScrollableResults()
    );
    if ( debugEnabled ) {
      LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
    }
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(AvailableSettings.WRAP_RESULT_SETS, properties, false);
    if ( debugEnabled ) {
      LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
    }
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(AvailableSettings.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
    if ( debugEnabled ) {
      LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
    }
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
View Full Code Here

    );

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    final MultiTableBulkIdStrategy multiTableBulkIdStrategy = getMultiTableBulkIdStrategy(
        properties,
        jdbcServices.getDialect(),
        classLoaderService
    );
    settings.setMultiTableBulkIdStrategy( multiTableBulkIdStrategy );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(AvailableSettings.FLUSH_BEFORE_COMPLETION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
    }
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(AvailableSettings.AUTO_CLOSE_SESSION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
    }
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(AvailableSettings.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) {
      batchSize = 0;
    }
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch size: %s", batchSize );
    }
    settings.setJdbcBatchSize(batchSize);

    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(AvailableSettings.BATCH_VERSIONED_DATA, properties, false);
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
    }
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
        AvailableSettings.USE_SCROLLABLE_RESULTSET,
        properties,
        meta.supportsScrollableResults()
    );
    if ( debugEnabled ) {
      LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
    }
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(AvailableSettings.WRAP_RESULT_SETS, properties, false);
    if ( debugEnabled ) {
      LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
    }
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(AvailableSettings.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
    if ( debugEnabled ) {
      LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
    }
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
View Full Code Here

    settings.setSessionFactoryName(sessionFactoryName);

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
        LOG.autoFlush(enabledDisabled(flushBeforeCompletion));
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
        LOG.autoSessionClose(enabledDisabled(autoCloseSession));
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) batchSize = 0;
    if (batchSize>0) LOG.jdbcBatchSize(batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
        if (batchSize > 0) LOG.jdbcBatchUpdates(enabledDisabled(jdbcBatchVersionedData));
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, meta.supportsScrollableResults());
        LOG.scrollabelResultSets(enabledDisabled(useScrollableResultSets));
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
        LOG.wrapResultSets(enabledDisabled(wrapResultSets));
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
        LOG.jdbc3GeneratedKeys(enabledDisabled(useGetGeneratedKeys));
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = ConfigurationHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
        if (statementFetchSize != null) LOG.jdbcResultSetFetchSize(statementFetchSize);
View Full Code Here

    );

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    final MultiTableBulkIdStrategy multiTableBulkIdStrategy = getMultiTableBulkIdStrategy(
        properties,
        jdbcServices.getDialect(),
        serviceRegistry.getService( ClassLoaderService.class )
    );
    settings.setMultiTableBulkIdStrategy( multiTableBulkIdStrategy );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(AvailableSettings.FLUSH_BEFORE_COMPLETION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
    }
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(AvailableSettings.AUTO_CLOSE_SESSION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
    }
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(AvailableSettings.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) {
      batchSize = 0;
    }
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch size: %s", batchSize );
    }
    settings.setJdbcBatchSize(batchSize);

    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(AvailableSettings.BATCH_VERSIONED_DATA, properties, false);
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
    }
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
        AvailableSettings.USE_SCROLLABLE_RESULTSET,
        properties,
        meta.supportsScrollableResults()
    );
    if ( debugEnabled ) {
      LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
    }
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(AvailableSettings.WRAP_RESULT_SETS, properties, false);
    if ( debugEnabled ) {
      LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
    }
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(AvailableSettings.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
    if ( debugEnabled ) {
      LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
    }
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
View Full Code Here

    );

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
    }
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
    }
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) {
      batchSize = 0;
    }
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch size: %s", batchSize );
    }
    settings.setJdbcBatchSize(batchSize);

    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
    }
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
        Environment.USE_SCROLLABLE_RESULTSET,
        properties,
        meta.supportsScrollableResults()
    );
    if ( debugEnabled ) {
      LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
    }
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    if ( debugEnabled ) {
      LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
    }
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
    if ( debugEnabled ) {
      LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
    }
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
View Full Code Here

    );

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
    }
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    if ( debugEnabled ) {
      LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
    }
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) {
      batchSize = 0;
    }
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch size: %s", batchSize );
    }
    settings.setJdbcBatchSize(batchSize);

    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if ( batchSize > 0 && debugEnabled ) {
      LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
    }
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
        Environment.USE_SCROLLABLE_RESULTSET,
        properties,
        meta.supportsScrollableResults()
    );
    if ( debugEnabled ) {
      LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
    }
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    if ( debugEnabled ) {
      LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
    }
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
    if ( debugEnabled ) {
      LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
    }
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
View Full Code Here

    if ( parameterStrategy == ParameterStrategy.POSITIONAL ) {
      throw new QueryException( "Cannot mix named and positional parameters" );
    }
    if ( parameterStrategy == null ) {
      // protect to only do this check once
      final ExtractedDatabaseMetaData databaseMetaData = getSession().getTransactionCoordinator()
          .getJdbcCoordinator()
          .getLogicalConnection()
          .getJdbcServices()
          .getExtractedMetaDataSupport();
      if ( ! databaseMetaData.supportsNamedParameters() ) {
        throw new NamedParametersNotSupportedException(
            "Named stored procedure parameters used, but JDBC driver does not support named parameters"
        );
      }
      parameterStrategy = ParameterStrategy.NAMED;
View Full Code Here

    settings.setSessionFactoryName(sessionFactoryName);

    //JDBC and connection settings:

    //Interrogate JDBC metadata
    ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

    settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
    settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:
    settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

    boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
        LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = ConfigurationHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
        LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = ConfigurationHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !meta.supportsBatchUpdates() ) {
      batchSize = 0;
    }
    if ( batchSize > 0 ) {
      LOG.debugf( "JDBC batch size: %s", batchSize );
    }
    settings.setJdbcBatchSize(batchSize);

    boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
        if ( batchSize > 0 ) {
      LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
    }
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

    boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
        Environment.USE_SCROLLABLE_RESULTSET,
        properties,
        meta.supportsScrollableResults()
    );
        LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = ConfigurationHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
        LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
        LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = ConfigurationHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
        if (statementFetchSize != null) {
View Full Code Here

TOP

Related Classes of org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData

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.