Top Description Fields Constructors Methods
org.hibernate.cfg

public final Class Environment

extends Object
implements AvailableSettings
Class Inheritance
All Implemented Interfaces
org.hibernate.cfg.AvailableSettings, org.hibernate.cfg.ValidationSettings, org.hibernate.cfg.TransactionSettings, org.hibernate.cfg.StatisticsSettings, org.hibernate.cfg.SessionEventSettings, org.hibernate.cfg.SchemaToolingSettings, org.hibernate.cfg.QuerySettings, org.hibernate.cfg.PersistenceSettings, org.hibernate.cfg.MultiTenancySettings, org.hibernate.cfg.MappingSettings, org.hibernate.cfg.ManagedBeanSettings, org.hibernate.cfg.JpaComplianceSettings, org.hibernate.cfg.JdbcSettings, org.hibernate.cfg.ProxoolSettings, org.hibernate.cfg.C3p0Settings, org.hibernate.cfg.FetchSettings, org.hibernate.cfg.EnvironmentSettings, org.hibernate.cfg.CacheSettings, org.hibernate.cfg.BytecodeSettings, org.hibernate.cfg.BatchSettings
Annotations
@Internal
Imports
java.io.IOException, .InputStream, java.util.Properties, org.hibernate.HibernateException, .Internal, .Version, org.hibernate.internal.CoreMessageLogger, org.hibernate.internal.util.ConfigHelper, org.hibernate.internal.util.config.ConfigurationHelper, org.jboss.logging.Logger

Provides access to configuration properties passed in Properties objects.

Hibernate has two property scopes:

Environment properties are populated by calling System#getProperties() and then from a resource named /hibernate.properties, if it exists. System properties override properties specified in hibernate.properties.

The org.hibernate.SessionFactory obtains properties from:

Configuration properties
PropertyInterpretation
hibernate.dialect name of org.hibernate.dialect.Dialect subclass
hibernate.connection.provider_class name of a org.hibernate.engine.jdbc.connections.spi.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 javax.naming.InitialContext URL
hibernate.jndi.classJNDI javax.naming.InitialContext class name
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_get_generated_keys enable use of JDBC3 java.sql.PreparedStatement#getGeneratedKeys() to retrieve natively generated keys after insert. Requires JDBC3+ driver and JRE1.4+
hibernate.hbm2ddl.auto 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.transaction.jta.platform name of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform implementation

API Note

This is really considered an internal contract, but leaving in place in this package as many applications use it historically. However, consider migrating to use AvailableSettings instead.

Author
Gavin King
See Also
org.hibernate.SessionFactory

Field Summary

Modifier and TypeField and Description
private static final Properties
private static final CoreMessageLogger

Constructor Summary

AccessConstructor and Description
private
Environment()

Disallow instantiation

Method Summary

Modifier and TypeMethod and Description
public static Properties
getProperties()

The system properties, extended with all additional properties specified in hibernate.properties.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GLOBAL_PROPERTIESback to summary
private static final Properties GLOBAL_PROPERTIES
LOGback to summary
private static final CoreMessageLogger LOG

Constructor Detail

Environmentback to summary
private Environment()

Disallow instantiation

Method Detail

getPropertiesback to summary
public static Properties getProperties()

The system properties, extended with all additional properties specified in hibernate.properties.