SessionBuilder (Hibernate JavaDocs)
Date: 2012-04-05

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate
Interface SessionBuilder

All Known Subinterfaces:
  SharedSessionBuilder

    public interface SessionBuilder

Represents a consolidation of all session creation options into a builder style delegate.

Method Summary
`SessionBuilder` | `autoClose(boolean autoClose)` Should the session be automatically closed after transaction completion
`SessionBuilder` | `autoJoinTransactions(boolean autoJoinTransactions)` Should the session built automatically join in any ongoing JTA transactions
`SessionBuilder` | `connection(Connection connection)` Adds a specific connection to the session options
`SessionBuilder` | `connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)` Use a specific connection release mode for these session options
`SessionBuilder` | `flushBeforeCompletion(boolean flushBeforeCompletion)` Should the session be automatically flushed during the "before completion" phase of transaction handling.
`SessionBuilder` | `interceptor(Interceptor interceptor)` Adds a specific interceptor to the session options
`SessionBuilder` | `noInterceptor()` Signifies that no `Interceptor` should be used.
`Session` | `openSession()` Opens a session with the specified options.
`SessionBuilder` | `tenantIdentifier(String tenantIdentifier)` Define the tenant identifier to be associated with the opened session.

Method Detail

### openSession

    Session openSession()

  Opens a session with the specified options.

  Returns:
    The session

### interceptor

    SessionBuilder interceptor(Interceptor interceptor)

  Adds a specific interceptor to the session options

  Parameters:
    `interceptor` - The interceptor to use.
  Returns:
    `this`, for method chaining

### noInterceptor

    SessionBuilder noInterceptor()

  Signifies that no `Interceptor` should be used.

  By default the `Interceptor` associated with the `SessionFactory` is passed to the `Session` whenever we open one without the user having specified a specific interceptor to use.

  Calling `interceptor(Interceptor)` with null has the same net effect.

  Returns:
    `this`, for method chaining

### connection

    SessionBuilder connection(Connection connection)

  Adds a specific connection to the session options

  Parameters:
    `connection` - The connection to use.
  Returns:
    `this`, for method chaining

### connectionReleaseMode

    SessionBuilder connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)

  Use a specific connection release mode for these session options

  Parameters:
    `connectionReleaseMode` - The connection release mode to use.
  Returns:
    `this`, for method chaining

### autoJoinTransactions

    SessionBuilder autoJoinTransactions(boolean autoJoinTransactions)

  Should the session built automatically join in any ongoing JTA transactions

  Parameters:
    `autoJoinTransactions` - Should JTA transactions be automatically joined
  Returns:
    `this`, for method chaining

### autoClose

    SessionBuilder autoClose(boolean autoClose)

  Should the session be automatically closed after transaction completion

  Parameters:
    `autoClose` - Should the session be automatically closed
  Returns:
    `this`, for method chaining

### flushBeforeCompletion

    SessionBuilder flushBeforeCompletion(boolean flushBeforeCompletion)

  Should the session be automatically flushed during the "before completion" phase of transaction handling.

  Parameters:
    `flushBeforeCompletion` - Should the session be automatically flushed
  Returns:
    `this`, for method chaining

### tenantIdentifier

    SessionBuilder tenantIdentifier(String tenantIdentifier)

  Define the tenant identifier to be associated with the opened session.

  Parameters:
    `tenantIdentifier` - The tenant identifier.
  Returns:
    `this`, for method chaining

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.