Class Environment

  • All Implemented Interfaces:
    AvailableSettings, AvailableSettings

    public final class Environment
    extends java.lang.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:
    • Field Detail


        public static final java.lang.String BYTECODE_PROVIDER_NAME_JAVASSIST
        See Also:
        Constant Field Values

        public static final java.lang.String BYTECODE_PROVIDER_NAME_BYTEBUDDY
        See Also:
        Constant Field Values

        public static final java.lang.String BYTECODE_PROVIDER_NAME_NONE
        See Also:
        Constant Field Values

        public static final java.lang.String BYTECODE_PROVIDER_NAME_DEFAULT
        See Also:
        Constant Field Values
    • Method Detail

      • verifyProperties

        public static void verifyProperties​(java.util.Map<?,​?> configurationValues)
        without replacement. Such verification is best done ad hoc, case by case.
        No longer effective.
        configurationValues - The specified properties.
      • jvmHasTimestampBug

        public static boolean jvmHasTimestampBug()
        removed as unnecessary
        This will be removed soon; currently just returns false as no known JVM exhibits this bug and is also able to run this version of Hibernate ORM.
      • useLegacyProxyClassnames

        public static boolean useLegacyProxyClassnames()
        This option will be removed soon and should not be relied on.
        True if global option org.hibernate.cfg.AvailableSettings#ENFORCE_LEGACY_PROXY_CLASSNAMES was enabled
      • getProperties

        public static java.util.Properties getProperties()
        Return System properties, extended by any properties specified in
      • isolationLevelToString

        public static java.lang.String isolationLevelToString​(int isolation)
        Use ConnectionProviderInitiator.toIsolationNiceName(java.lang.Integer) instead
      • buildBytecodeProvider

        public static BytecodeProvider buildBytecodeProvider​(java.util.Properties properties)