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
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
/hibernate.properties if it exists. System
properties override properties specified in
hibernate.properties.
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.buildSessionFactory()
property | meaning |
hibernate.dialect | classname of org.hibernate.dialect.Dialect subclass |
hibernate.cache.provider_class | classname of org.hibernate.cache.CacheProvider
subclass (if not specified EHCache is used) |
hibernate.connection.provider_class | classname of org.hibernate.connection.ConnectionProvider
subclass (if not specified hueristics 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 | databasource 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 this 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.manager_lookup_class | classname of org.hibernate.transaction.TransactionManagerLookup
implementor |
hibernate.transaction.factory_class | the factory to use for instantiating Transactions.
(Defaults to JDBCTransactionFactory.) |
hibernate.query.substitutions | query language token substitutions |
AUTOCOMMIT
public static final String AUTOCOMMIT
JDBC autocommit mode
AUTO_CLOSE_SESSION
public static final String AUTO_CLOSE_SESSION
Enable automatic session close at end of transaction
BATCH_STRATEGY
public static final String BATCH_STRATEGY
Select a custom batcher.
BATCH_VERSIONED_DATA
public static final String BATCH_VERSIONED_DATA
Should versioned data be included in batching?
BYTECODE_PROVIDER
public static final String BYTECODE_PROVIDER
C3P0_ACQUIRE_INCREMENT
public static final String C3P0_ACQUIRE_INCREMENT
Number of connections acquired when pool is exhausted
C3P0_IDLE_TEST_PERIOD
public static final String C3P0_IDLE_TEST_PERIOD
Idle time before a C3P0 pooled connection is validated
C3P0_MAX_SIZE
public static final String C3P0_MAX_SIZE
Maximum size of C3P0 connection pool
C3P0_MAX_STATEMENTS
public static final String C3P0_MAX_STATEMENTS
Maximum size of C3P0 statement cache
C3P0_MIN_SIZE
public static final String C3P0_MIN_SIZE
Minimum size of C3P0 connection pool
C3P0_TIMEOUT
public static final String C3P0_TIMEOUT
Maximum idle time for C3P0 connection pool
CACHE_NAMESPACE
public static final String CACHE_NAMESPACE
The CacheProvider JNDI namespace, if pre-bound to JNDI.
CACHE_PROVIDER
public static final String CACHE_PROVIDER
The CacheProvider implementation class
CACHE_PROVIDER_CONFIG
public static final String CACHE_PROVIDER_CONFIG
The CacheProvider implementation class
CACHE_REGION_FACTORY
public static final String CACHE_REGION_FACTORY
CACHE_REGION_PREFIX
public static final String CACHE_REGION_PREFIX
The CacheProvider region name prefix
CONNECTION_PREFIX
public static final String CONNECTION_PREFIX
prefix for arbitrary JDBC connection properties
CONNECTION_PROVIDER
public static final String CONNECTION_PROVIDER
ConnectionProvider implementor to use when obtaining connections
CURRENT_SESSION_CONTEXT_CLASS
public static final String CURRENT_SESSION_CONTEXT_CLASS
DATASOURCE
public static final String DATASOURCE
java.sql.Datasource JNDI name
DEFAULT_BATCH_FETCH_SIZE
public static final String DEFAULT_BATCH_FETCH_SIZE
The default batch size for batch fetching
DEFAULT_CATALOG
public static final String DEFAULT_CATALOG
A default database catalog name to use for unqualified tablenames
DEFAULT_ENTITY_MODE
public static final String DEFAULT_ENTITY_MODE
The EntityMode in which set the Session opened from the SessionFactory.
DEFAULT_SCHEMA
public static final String DEFAULT_SCHEMA
A default database schema (owner) name to use for unqualified tablenames
DIALECT
public static final String DIALECT
Hibernate SQL Dialect class
DRIVER
public static final String DRIVER
JDBC driver class
FLUSH_BEFORE_COMPLETION
public static final String FLUSH_BEFORE_COMPLETION
Enable automatic flush during the JTA beforeCompletion() callback
FORMAT_SQL
public static final String FORMAT_SQL
Enable formatting of SQL logged to the console
GENERATE_STATISTICS
public static final String GENERATE_STATISTICS
Enable statistics collection
HBM2DDL_AUTO
public static final String HBM2DDL_AUTO
Auto export/update schema using hbm2ddl tool. Valid values are update,
create, create-drop and validate.
ISOLATION
public static final String ISOLATION
JDBC transaction isolation level
JACC_CONTEXTID
public static final String JACC_CONTEXTID
The jacc context id of the deployment
JNDI_CLASS
public static final String JNDI_CLASS
JNDI initial context class, Context.INITIAL_CONTEXT_FACTORY
JNDI_PREFIX
public static final String JNDI_PREFIX
prefix for arbitrary JNDI InitialContext properties
JNDI_URL
public static final String JNDI_URL
JNDI provider URL, Context.PROVIDER_URL
JPAQL_STRICT_COMPLIANCE
public static final String JPAQL_STRICT_COMPLIANCE
MAX_FETCH_DEPTH
public static final String MAX_FETCH_DEPTH
Maximum depth of outer join fetching
ORDER_INSERTS
public static final String ORDER_INSERTS
Enable ordering of insert statements for the purpose of more effecient JDBC batching.
ORDER_UPDATES
public static final String ORDER_UPDATES
Enable ordering of update statements by primary key value
OUTPUT_STYLESHEET
public static final String OUTPUT_STYLESHEET
An XSLT resource used to generate "custom" XML
PASS
public static final String PASS
JDBC password
POOL_SIZE
public static final String POOL_SIZE
Maximum number of inactive connections for Hibernate's connection pool
PROXOOL_EXISTING_POOL
public static final String PROXOOL_EXISTING_POOL
Proxool property to configure the Proxool Provider from an already existing pool (true / false)
PROXOOL_POOL_ALIAS
public static final String PROXOOL_POOL_ALIAS
Proxool property with the Proxool pool alias to use
(Required for PROXOOL_EXISTING_POOL, PROXOOL_PROPERTIES, or
PROXOOL_XML)
PROXOOL_PREFIX
public static final String PROXOOL_PREFIX
Proxool/Hibernate property prefix
PROXOOL_PROPERTIES
public static final String PROXOOL_PROPERTIES
Proxool property to configure the Proxool Provider using a properties file (/path/to/proxool.properties)
PROXOOL_XML
public static final String PROXOOL_XML
Proxool property to configure the Proxool Provider using an XML (/path/to/file.xml)
QUERY_CACHE_FACTORY
public static final String QUERY_CACHE_FACTORY
The QueryCacheFactory implementation class.
QUERY_STARTUP_CHECKING
public static final String QUERY_STARTUP_CHECKING
Should named queries be checked during startup (the default is enabled).
Mainly intended for test environments.
QUERY_SUBSTITUTIONS
public static final String QUERY_SUBSTITUTIONS
A comma-seperated list of token substitutions to use when translating a Hibernate
query to SQL
QUERY_TRANSLATOR
public static final String QUERY_TRANSLATOR
The classname of the HQL query parser factory
RELEASE_CONNECTIONS
public static final String RELEASE_CONNECTIONS
Specifies how Hibernate should release JDBC connections.
SESSION_FACTORY_NAME
public static final String SESSION_FACTORY_NAME
JNDI name to bind to SessionFactory
SHOW_SQL
public static final String SHOW_SQL
Enable logging of generated SQL to the console
SQL_EXCEPTION_CONVERTER
public static final String SQL_EXCEPTION_CONVERTER
The
SQLExceptionConverter
to use for converting SQLExceptions
to Hibernate's JDBCException hierarchy. The default is to use the configured
Dialect
's preferred SQLExceptionConverter.
STATEMENT_BATCH_SIZE
public static final String STATEMENT_BATCH_SIZE
Maximum JDBC batch size. A nonzero value enables batch updates.
STATEMENT_FETCH_SIZE
public static final String STATEMENT_FETCH_SIZE
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database
when more rows are needed. If 0, JDBC driver default settings will be used.
TRANSACTION_MANAGER_STRATEGY
public static final String TRANSACTION_MANAGER_STRATEGY
TransactionManagerLookup implementor to use for obtaining the TransactionManager
TRANSACTION_STRATEGY
public static final String TRANSACTION_STRATEGY
TransactionFactory implementor to use for creating Transactions
URL
public static final String URL
JDBC URL
USER
public static final String USER
JDBC user
USER_TRANSACTION
public static final String USER_TRANSACTION
JNDI name of JTA UserTransaction object
USE_GET_GENERATED_KEYS
public static final String USE_GET_GENERATED_KEYS
Tells the JDBC driver to attempt to retrieve row Id with the JDBC 3.0 PreparedStatement.getGeneratedKeys()
method. In general, performance will be better if this property is set to true and the underlying
JDBC driver supports getGeneratedKeys().
USE_IDENTIFIER_ROLLBACK
public static final String USE_IDENTIFIER_ROLLBACK
USE_MINIMAL_PUTS
public static final String USE_MINIMAL_PUTS
Optimize the cache for mimimal puts instead of minimal gets
USE_QUERY_CACHE
public static final String USE_QUERY_CACHE
Enable the query cache (disabled by default)
USE_REFLECTION_OPTIMIZER
public static final String USE_REFLECTION_OPTIMIZER
Use bytecode libraries optimized property access
USE_SCROLLABLE_RESULTSET
public static final String USE_SCROLLABLE_RESULTSET
Use JDBC scrollable ResultSets. This property is only necessary when there is
no ConnectionProvider, ie. the user is supplying JDBC connections.
USE_SECOND_LEVEL_CACHE
public static final String USE_SECOND_LEVEL_CACHE
Enable the second-level cache (enabled by default)
USE_SQL_COMMENTS
public static final String USE_SQL_COMMENTS
Add comments to the generated SQL
USE_STREAMS_FOR_BINARY
public static final String USE_STREAMS_FOR_BINARY
Use java.io streams to read / write binary data from / to JDBC
USE_STRUCTURED_CACHE
public static final String USE_STRUCTURED_CACHE
Enable use of structured second-level cache entries
VERSION
public static final String VERSION
WRAP_RESULT_SETS
public static final String WRAP_RESULT_SETS
Enable wrapping of JDBC result sets in order to speed up column name lookups for
broken JDBC drivers