Class Environment

  • All Implemented Interfaces:

    public final class Environment
    extends Object
    implements AvailableSettings
    Provides access to configuration info passed in Properties objects.

    Hibernate has two property scopes:
    • Factory-level properties may be passed to the SessionFactory when it is instantiated. Each instance might have different property values. If no properties are specified, the factory calls Environment.getProperties().
    • System-level properties are shared by all factory instances and are always determined by the Environment properties.
    The only system-level properties are
    • hibernate.jdbc.use_streams_for_binary
    • hibernate.cglib.use_reflection_optimizer
    Environment properties are populated by calling System.getProperties() and then from a resource named / if it exists. System properties override properties specified in

    The SessionFactory is controlled by the following properties. Properties may be either be System properties, properties defined in a resource named / or an instance of java.util.Properties passed to

    hibernate.dialect classname of org.hibernate.dialect.Dialect subclass
    hibernate.connection.provider_class classname of ConnectionProvider subclass (if not specified heuristics are used)
    hibernate.connection.usernamedatabase username
    hibernate.connection.passworddatabase password
    hibernate.connection.url JDBC URL (when using java.sql.DriverManager)
    hibernate.connection.driver_class classname of JDBC driver
    hibernate.connection.isolation JDBC transaction isolation level (only when using java.sql.DriverManager)
    hibernate.connection.pool_size the maximum size of the connection pool (only when using java.sql.DriverManager)
    hibernate.connection.datasource datasource JNDI name (when using javax.sql.Datasource)
    hibernate.jndi.urlJNDI InitialContext URL
    hibernate.jndi.classJNDI InitialContext classname
    hibernate.max_fetch_depth maximum depth of outer join fetching
    hibernate.jdbc.batch_size enable use of JDBC2 batch API for drivers which support it
    hibernate.jdbc.fetch_size set the JDBC fetch size
    hibernate.jdbc.use_scrollable_resultset enable use of JDBC2 scrollable resultsets (you only need to specify this property when using user supplied connections)
    hibernate.jdbc.use_getGeneratedKeys enable use of JDBC3 PreparedStatement.getGeneratedKeys() to retrieve natively generated keys after insert. Requires JDBC3+ driver and JRE1.4+ enable auto DDL export
    hibernate.default_schema use given schema name for unqualified tables (always optional)
    hibernate.default_catalog use given catalog name for unqualified tables (always optional)
    hibernate.session_factory_name If set, the factory attempts to bind this name to itself in the JNDI context. This name is also used to support cross JVM Session (de)serialization.
    hibernate.transaction.jta.platform classname of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform implementor
    hibernate.transaction.factory_class the factory to use for instantiating Transactions. (Defaults to JdbcTransactionFactory.)
    hibernate.query.substitutionsquery language token substitutions
    See Also: