Package org.hibernate.transaction

Examples of org.hibernate.transaction.TransactionFactory$Context


    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll(props);
   
    // Transaction settings:
   
    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );
   
    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here


    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:

    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );

    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:

    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );

    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:

    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );

    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:

    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );

    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll(props);
   
    // Transaction settings:
   
    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );
   
    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll(props);
   
    // Transaction settings:
   
    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );
   
    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll(props);
   
    // Transaction settings:
   
    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );
   
    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

      }
    }
  }

  boolean wrapInTransaction() {
    final TransactionFactory transactionFactory = factory.getSettings().getTransactionFactory();
    if ( !transactionFactory.isTransactionManagerRequired() ) {
      //Today we only require a TransactionManager on JTA based transaction factories
      log.trace( "TransactionFactory does not require a TransactionManager: don't wrap in a JTA transaction" );
      return false;
    }
    final TransactionManager transactionManager = factory.getTransactionManager();
View Full Code Here

    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll( props );

    // Transaction settings:

    TransactionFactory transactionFactory = createTransactionFactory(properties);
    settings.setTransactionFactory(transactionFactory);
    settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );

    boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
    log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
    settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

    boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
    log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
    settings.setAutoCloseSessionEnabled(autoCloseSession);

    //JDBC and connection settings:

    int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
    if ( !metaSupportsBatchUpdates ) batchSize = 0;
    if (batchSize>0) log.info("JDBC batch size: " + batchSize);
    settings.setJdbcBatchSize(batchSize);
    boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
    if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
    settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
    settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );

    boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
    log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
    settings.setScrollableResultSetsEnabled(useScrollableResultSets);

    boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
    log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
    settings.setWrapResultSetsEnabled(wrapResultSets);

    boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
    log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
    settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

    Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
    if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
    settings.setJdbcFetchSize(statementFetchSize);

    String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
    log.info( "Connection release mode: " + releaseModeName );
    ConnectionReleaseMode releaseMode;
    if ( "auto".equals(releaseModeName) ) {
      releaseMode = transactionFactory.getDefaultReleaseMode();
    }
    else {
      releaseMode = ConnectionReleaseMode.parse( releaseModeName );
      if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) {
        log.warn( "Overriding release mode as connection provider does not support 'after_statement'" );
View Full Code Here

TOP

Related Classes of org.hibernate.transaction.TransactionFactory$Context

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.