Package org.hibernate.cfg
Class Environment
- java.lang.Object
-
- org.hibernate.cfg.Environment
-
- All Implemented Interfaces:
AvailableSettings
,AvailableSettings
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.
- hibernate.jdbc.use_streams_for_binary
- hibernate.cglib.use_reflection_optimizer
The SessionFactory is controlled by the following properties. Properties may be either be System properties, properties defined in a resource named /hibernate.properties or an instance of java.util.Properties passed to Configuration.build()
property meaning 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.username database username hibernate.connection.password database 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.url JNDI InitialContext URL hibernate.jndi.class JNDI 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+ 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.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.substitutions query language token substitutions - See Also:
SessionFactory
-
-
Field Summary
Fields Modifier and Type Field Description static String
BYTECODE_PROVIDER_NAME_BYTEBUDDY
static String
BYTECODE_PROVIDER_NAME_DEFAULT
static String
BYTECODE_PROVIDER_NAME_JAVASSIST
static String
BYTECODE_PROVIDER_NAME_NONE
-
Fields inherited from interface org.hibernate.cfg.AvailableSettings
ACQUIRE_CONNECTIONS, ALLOW_ENHANCEMENT_AS_PROXY, ALLOW_JTA_TRANSACTION_ACCESS, ALLOW_REFRESH_DETACHED_ENTITY, ALLOW_UPDATE_OUTSIDE_TRANSACTION, APP_CLASSLOADER, ARTIFACT_PROCESSING_ORDER, AUTO_CLOSE_SESSION, AUTO_EVICT_COLLECTION_CACHE, AUTO_SESSION_EVENTS_LISTENER, AUTOCOMMIT, BATCH_FETCH_STYLE, BATCH_STRATEGY, BATCH_VERSIONED_DATA, BEAN_CONTAINER, BYTECODE_PROVIDER, C3P0_ACQUIRE_INCREMENT, C3P0_CONFIG_PREFIX, C3P0_IDLE_TEST_PERIOD, C3P0_MAX_SIZE, C3P0_MAX_STATEMENTS, C3P0_MIN_SIZE, C3P0_TIMEOUT, CACHE_KEYS_FACTORY, CACHE_PROVIDER_CONFIG, CACHE_REGION_FACTORY, CACHE_REGION_PREFIX, CDI_BEAN_MANAGER, CFG_XML_FILE, CHECK_NULLABILITY, CLASS_CACHE_PREFIX, CLASSLOADERS, COLLECTION_CACHE_PREFIX, COLLECTION_JOIN_SUBQUERY, CONNECTION_HANDLING, CONNECTION_PREFIX, CONNECTION_PROVIDER, CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT, CONVENTIONAL_JAVA_CONSTANTS, CREATE_EMPTY_COMPOSITES_ENABLED, CRITERIA_LITERAL_HANDLING_MODE, CURRENT_SESSION_CONTEXT_CLASS, CUSTOM_ENTITY_DIRTINESS_STRATEGY, DATASOURCE, DEFAULT_BATCH_FETCH_SIZE, DEFAULT_CACHE_CONCURRENCY_STRATEGY, DEFAULT_CATALOG, DEFAULT_ENTITY_MODE, DEFAULT_NULL_ORDERING, DEFAULT_SCHEMA, DELAY_ENTITY_LOADER_CREATIONS, DEPRECATED_EXTRA_PHYSICAL_TABLE_TYPES, DIALECT, DIALECT_RESOLVERS, DISCARD_PC_ON_CLOSE, DRIVER, EMF_NAME, ENABLE_LAZY_LOAD_NO_TRANS, ENABLE_SYNONYMS, ENFORCE_LEGACY_PROXY_CLASSNAMES, ENVIRONMENT_CLASSLOADER, EVENT_LISTENER_PREFIX, EXTRA_PHYSICAL_TABLE_TYPES, FAIL_ON_PAGINATION_OVER_COLLECTION_FETCH, FLUSH_BEFORE_COMPLETION, FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT, FORMAT_SQL, GENERATE_STATISTICS, GLOBALLY_QUOTED_IDENTIFIERS, GLOBALLY_QUOTED_IDENTIFIERS_SKIP_COLUMN_DEFINITIONS, HBM_XML_FILES, HBM2DDL_AUTO, HBM2DDL_CHARSET_NAME, HBM2DDL_CONNECTION, HBM2DDL_CREATE_NAMESPACES, HBM2DDL_CREATE_SCHEMAS, HBM2DDL_CREATE_SCRIPT_SOURCE, HBM2DDL_CREATE_SOURCE, HBM2DDL_DATABASE_ACTION, HBM2DDL_DB_MAJOR_VERSION, HBM2DDL_DB_MINOR_VERSION, HBM2DDL_DB_NAME, HBM2DDL_DEFAULT_CONSTRAINT_MODE, HBM2DDL_DELIMITER, HBM2DDL_DROP_SCRIPT_SOURCE, HBM2DDL_DROP_SOURCE, HBM2DDL_FILTER_PROVIDER, HBM2DDL_HALT_ON_ERROR, HBM2DDL_IMPORT_FILES, HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR, HBM2DDL_JDBC_METADATA_EXTRACTOR_STRATEGY, HBM2DDL_LOAD_SCRIPT_SOURCE, HBM2DDL_SCRIPTS_ACTION, HBM2DDL_SCRIPTS_CREATE_APPEND, HBM2DDL_SCRIPTS_CREATE_TARGET, HBM2DDL_SCRIPTS_DROP_TARGET, HBM2DLL_CREATE_NAMESPACES, HBM2DLL_CREATE_SCHEMAS, HIBERNATE_CLASSLOADER, HIGHLIGHT_SQL, HQL_BULK_ID_STRATEGY, IDENTIFIER_GENERATOR_STRATEGY_PROVIDER, IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS, IMMUTABLE_ENTITY_UPDATE_QUERY_HANDLING_MODE, IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS, IMPLICIT_NAMING_STRATEGY, IN_CLAUSE_PARAMETER_PADDING, INTERCEPTOR, ISOLATION, JACC_CONTEXT_ID, JACC_ENABLED, JACC_PREFIX, JAKARTA_CDI_BEAN_MANAGER, JAKARTA_HBM2DDL_CONNECTION, JAKARTA_HBM2DDL_CREATE_SCHEMAS, JAKARTA_HBM2DDL_CREATE_SCRIPT_SOURCE, JAKARTA_HBM2DDL_CREATE_SOURCE, JAKARTA_HBM2DDL_DATABASE_ACTION, JAKARTA_HBM2DDL_DB_MAJOR_VERSION, JAKARTA_HBM2DDL_DB_MINOR_VERSION, JAKARTA_HBM2DDL_DB_NAME, JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE, JAKARTA_HBM2DDL_DROP_SOURCE, JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE, JAKARTA_HBM2DDL_SCRIPTS_ACTION, JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, JAKARTA_HBM2DDL_SCRIPTS_DROP_TARGET, JAKARTA_JPA_JDBC_DRIVER, JAKARTA_JPA_JDBC_PASSWORD, JAKARTA_JPA_JDBC_URL, JAKARTA_JPA_JDBC_USER, JAKARTA_JPA_JTA_DATASOURCE, JAKARTA_JPA_LOCK_SCOPE, JAKARTA_JPA_LOCK_TIMEOUT, JAKARTA_JPA_NON_JTA_DATASOURCE, JAKARTA_JPA_PERSIST_VALIDATION_GROUP, JAKARTA_JPA_PERSISTENCE_PROVIDER, JAKARTA_JPA_REMOVE_VALIDATION_GROUP, JAKARTA_JPA_SHARED_CACHE_MODE, JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE, JAKARTA_JPA_SHARED_CACHE_STORE_MODE, JAKARTA_JPA_TRANSACTION_TYPE, JAKARTA_JPA_UPDATE_VALIDATION_GROUP, JAKARTA_JPA_VALIDATION_FACTORY, JAKARTA_JPA_VALIDATION_MODE, JDBC_TIME_ZONE, JDBC_TYLE_PARAMS_ZERO_BASE, JMX_AGENT_ID, JMX_DEFAULT_OBJ_NAME_DOMAIN, JMX_DOMAIN_NAME, JMX_ENABLED, JMX_PLATFORM_SERVER, JMX_SF_NAME, JNDI_CLASS, JNDI_PREFIX, JNDI_URL, JPA_CACHING_COMPLIANCE, JPA_CALLBACKS_ENABLED, JPA_CLOSED_COMPLIANCE, JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE, JPA_JDBC_DRIVER, JPA_JDBC_PASSWORD, JPA_JDBC_URL, JPA_JDBC_USER, JPA_JTA_DATASOURCE, JPA_LIST_COMPLIANCE, JPA_LOCK_SCOPE, JPA_LOCK_TIMEOUT, JPA_METAMODEL_GENERATION, JPA_METAMODEL_POPULATION, JPA_NON_JTA_DATASOURCE, JPA_PERSIST_VALIDATION_GROUP, JPA_PERSISTENCE_PROVIDER, JPA_PROXY_COMPLIANCE, JPA_QUERY_COMPLIANCE, JPA_REMOVE_VALIDATION_GROUP, JPA_SHARED_CACHE_MODE, JPA_SHARED_CACHE_RETRIEVE_MODE, JPA_SHARED_CACHE_STORE_MODE, JPA_TRANSACTION_COMPLIANCE, JPA_TRANSACTION_TYPE, JPA_UPDATE_VALIDATION_GROUP, JPA_VALIDATION_FACTORY, JPA_VALIDATION_MODE, JPAQL_STRICT_COMPLIANCE, JTA_CACHE_TM, JTA_CACHE_UT, JTA_PLATFORM, JTA_PLATFORM_RESOLVER, JTA_TRACK_BY_THREAD, KEYWORD_AUTO_QUOTING_ENABLED, LOADED_CLASSES, LOG_JDBC_WARNINGS, LOG_SESSION_METRICS, LOG_SLOW_QUERY, MAX_FETCH_DEPTH, MERGE_ENTITY_COPY_OBSERVER, MULTI_TENANT, MULTI_TENANT_CONNECTION_PROVIDER, MULTI_TENANT_IDENTIFIER_RESOLVER, NATIVE_EXCEPTION_HANDLING_51_COMPLIANCE, NON_CONTEXTUAL_LOB_CREATION, OMIT_JOIN_OF_SUPERCLASS_TABLES, ORDER_INSERTS, ORDER_UPDATES, ORM_XML_FILES, PASS, PERSISTENCE_UNIT_NAME, PHYSICAL_NAMING_STRATEGY, POOL_SIZE, PREFER_GENERATOR_NAME_AS_DEFAULT_SEQUENCE_NAME, PREFER_POOLED_VALUES_LO, PREFER_USER_TRANSACTION, PREFERRED_POOLED_OPTIMIZER, PROCEDURE_NULL_PARAM_PASSING, PROXOOL_CONFIG_PREFIX, PROXOOL_EXISTING_POOL, PROXOOL_POOL_ALIAS, PROXOOL_PREFIX, PROXOOL_PROPERTIES, PROXOOL_XML, QUERY_CACHE_FACTORY, QUERY_PLAN_CACHE_MAX_SIZE, QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES, QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES, QUERY_PLAN_CACHE_PARAMETER_METADATA_MAX_SIZE, QUERY_STARTUP_CHECKING, QUERY_STATISTICS_MAX_SIZE, QUERY_SUBSTITUTIONS, QUERY_TRANSLATOR, RELEASE_CONNECTIONS, RESOURCES_CLASSLOADER, SCANNER, SCANNER_ARCHIVE_INTERPRETER, SCANNER_DEPRECATED, SCANNER_DISCOVERY, SCHEMA_MANAGEMENT_TOOL, SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY, SESSION_FACTORY_NAME, SESSION_FACTORY_NAME_IS_JNDI, SESSION_FACTORY_OBSERVER, SESSION_SCOPED_INTERCEPTOR, SHOW_SQL, SQL_EXCEPTION_CONVERTER, STATEMENT_BATCH_SIZE, STATEMENT_FETCH_SIZE, STATEMENT_INSPECTOR, STATIC_METAMODEL_POPULATION, STORAGE_ENGINE, TABLE_GENERATOR_STORE_LAST_USED, TC_CLASSLOADER, TRANSACTION_COORDINATOR_STRATEGY, UNIQUE_CONSTRAINT_SCHEMA_UPDATE_STRATEGY, URL, USE_DIRECT_REFERENCE_CACHE_ENTRIES, USE_ENTITY_WHERE_CLAUSE_FOR_COLLECTIONS, USE_GET_GENERATED_KEYS, USE_IDENTIFIER_ROLLBACK, USE_LEGACY_LIMIT_HANDLERS, USE_MINIMAL_PUTS, USE_NATIONALIZED_CHARACTER_DATA, USE_NEW_ID_GENERATOR_MAPPINGS, USE_QUERY_CACHE, USE_REFLECTION_OPTIMIZER, USE_SCROLLABLE_RESULTSET, USE_SECOND_LEVEL_CACHE, USE_SQL_COMMENTS, USE_STREAMS_FOR_BINARY, USE_STRUCTURED_CACHE, USER, VALIDATE_QUERY_PARAMETERS, WRAP_RESULT_SETS, XML_MAPPING_ENABLED
-
Fields inherited from interface org.hibernate.jpa.AvailableSettings
ALIAS_SPECIFIC_LOCK_MODE, CFG_FILE, DELAY_CDI_ACCESS, ENHANCER_ENABLE_ASSOCIATION_MANAGEMENT, ENHANCER_ENABLE_DIRTY_TRACKING, ENHANCER_ENABLE_LAZY_INITIALIZATION, ENTITY_MANAGER_FACTORY_NAME, FLUSH_MODE, HBXML_FILES, JDBC_DRIVER, JDBC_PASSWORD, JDBC_URL, JDBC_USER, JTA_DATASOURCE, LOCK_SCOPE, LOCK_TIMEOUT, NON_JTA_DATASOURCE, PERSIST_VALIDATION_GROUP, PROVIDER, REMOVE_VALIDATION_GROUP, SCHEMA_GEN_CONNECTION, SCHEMA_GEN_CREATE_SCHEMAS, SCHEMA_GEN_CREATE_SCRIPT_SOURCE, SCHEMA_GEN_CREATE_SOURCE, SCHEMA_GEN_DATABASE_ACTION, SCHEMA_GEN_DB_MAJOR_VERSION, SCHEMA_GEN_DB_MINOR_VERSION, SCHEMA_GEN_DB_NAME, SCHEMA_GEN_DROP_SCRIPT_SOURCE, SCHEMA_GEN_DROP_SOURCE, SCHEMA_GEN_LOAD_SCRIPT_SOURCE, SCHEMA_GEN_SCRIPTS_ACTION, SCHEMA_GEN_SCRIPTS_CREATE_TARGET, SCHEMA_GEN_SCRIPTS_DROP_TARGET, SESSION_INTERCEPTOR, SHARED_CACHE_MODE, SHARED_CACHE_RETRIEVE_MODE, SHARED_CACHE_STORE_MODE, TRANSACTION_TYPE, UPDATE_VALIDATION_GROUP, VALIDATION_FACTORY, VALIDATION_MODE, XML_FILE_NAMES
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static BytecodeProvider
buildBytecodeProvider(Properties properties)
static BytecodeProvider
getBytecodeProvider()
Deprecated.Deprecated to indicate that the method will be moved toSessionFactoryOptions
/SessionFactoryBuilder
- probably in 6.0.static Properties
getProperties()
Return System properties, extended by any properties specified in hibernate.properties.static String
isolationLevelToString(int isolation)
Deprecated.UseConnectionProviderInitiator.toIsolationNiceName(java.lang.Integer)
insteadstatic boolean
jvmHasTimestampBug()
Deprecated.removed as unnecessarystatic boolean
useLegacyProxyClassnames()
Deprecated.This option will be removed soon and should not be relied on.static boolean
useReflectionOptimizer()
Deprecated.Deprecated to indicate that the method will be moved toSessionFactoryOptions
/SessionFactoryBuilder
- probably in 6.0.static boolean
useStreamsForBinary()
Deprecated.Deprecated to indicate that the method will be moved toSessionFactoryOptions
/SessionFactoryBuilder
- probably in 6.0.static void
verifyProperties(Map<?,?> configurationValues)
Deprecated.without replacement.
-
-
-
Field Detail
-
BYTECODE_PROVIDER_NAME_JAVASSIST
public static final String BYTECODE_PROVIDER_NAME_JAVASSIST
- See Also:
- Constant Field Values
-
BYTECODE_PROVIDER_NAME_BYTEBUDDY
public static final String BYTECODE_PROVIDER_NAME_BYTEBUDDY
- See Also:
- Constant Field Values
-
BYTECODE_PROVIDER_NAME_NONE
public static final String BYTECODE_PROVIDER_NAME_NONE
- See Also:
- Constant Field Values
-
BYTECODE_PROVIDER_NAME_DEFAULT
public static final String BYTECODE_PROVIDER_NAME_DEFAULT
- See Also:
- Constant Field Values
-
-
Method Detail
-
verifyProperties
@Deprecated public static void verifyProperties(Map<?,?> configurationValues)
Deprecated.without replacement. Such verification is best done ad hoc, case by case.No longer effective.- Parameters:
configurationValues
- The specified properties.
-
jvmHasTimestampBug
@Deprecated public static boolean jvmHasTimestampBug()
Deprecated.removed as unnecessaryThis 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.- Returns:
- false
-
useStreamsForBinary
@Deprecated public static boolean useStreamsForBinary()
Deprecated.Deprecated to indicate that the method will be moved toSessionFactoryOptions
/SessionFactoryBuilder
- probably in 6.0. See HHH-12194 and HHH-12193 for detailsShould we use streams to bind binary types to JDBC IN parameters?- Returns:
- True if streams should be used for binary data handling; false otherwise.
- See Also:
AvailableSettings.USE_STREAMS_FOR_BINARY
-
useReflectionOptimizer
@Deprecated public static boolean useReflectionOptimizer()
Deprecated.Deprecated to indicate that the method will be moved toSessionFactoryOptions
/SessionFactoryBuilder
- probably in 6.0. See HHH-12194 and HHH-12193 for detailsShould we use reflection optimization?- Returns:
- True if reflection optimization should be used; false otherwise.
- See Also:
AvailableSettings.USE_REFLECTION_OPTIMIZER
,getBytecodeProvider()
,BytecodeProvider.getReflectionOptimizer(java.lang.Class, java.lang.String[], java.lang.String[], java.lang.Class[])
-
getBytecodeProvider
@Deprecated public static BytecodeProvider getBytecodeProvider()
Deprecated.Deprecated to indicate that the method will be moved toSessionFactoryOptions
/SessionFactoryBuilder
- probably in 6.0. See HHH-12194 and HHH-12193 for details
-
useLegacyProxyClassnames
@Deprecated public static boolean useLegacyProxyClassnames()
Deprecated.This option will be removed soon and should not be relied on.- Returns:
- True if global option org.hibernate.cfg.AvailableSettings#ENFORCE_LEGACY_PROXY_CLASSNAMES was enabled
-
getProperties
public static Properties getProperties()
Return System properties, extended by any properties specified in hibernate.properties.- Returns:
- Properties
-
isolationLevelToString
@Deprecated public static String isolationLevelToString(int isolation)
Deprecated.UseConnectionProviderInitiator.toIsolationNiceName(java.lang.Integer)
instead
-
buildBytecodeProvider
public static BytecodeProvider buildBytecodeProvider(Properties properties)
-
-