Hibernate.orgCommunity Documentation

Appendix A. Configuration properties

Table of Contents

A.1. Strategy configurations
A.2. General Configuration
A.3. Database configuration
A.4. Connection pool properties

Many configuration settings define pluggable strategies that Hibernate uses for various purposes. The configuration of many of these strategy type settings accept definition in various forms. The documentation of such configuration settings refer here. The types of forms available in such cases include:

short name (if defined)

Certain built-in strategy implementations have a corresponding short name.

strategy instance

An instance of the strategy implementation to use can be specified

strategy Class reference

A java.lang.Class reference of the strategy implementation to use can be specified

strategy Class name

The class name (java.lang.String) of the strategy implementation to use can be specified

hibernate.dialectA fully-qualified classname

The classname of a Hibernate org.hibernate.dialect.Dialect from which Hibernate can generate SQL optimized for a particular relational database.

In most cases Hibernate can choose the correct org.hibernate.dialect.Dialect implementation based on the JDBC metadata returned by the JDBC driver.

hibernate.show_sql

true or false

Write all SQL statements to the console. This is an alternative to setting the log category org.hibernate.SQL to debug.
hibernate.format_sql

true or false

Pretty-print the SQL in the log and console.
hibernate.default_schemaA schema nameQualify unqualified table names with the given schema or tablespace in generated SQL.
hibernate.default_catalogA catalog nameQualifies unqualified table names with the given catalog in generated SQL.
hibernate.session_factory_nameA JNDI nameThe org.hibernate.SessionFactory is automatically bound to this name in JNDI after it is created.
hibernate.max_fetch_depthA value between 0 and 3Sets a maximum depth for the outer join fetch tree for single-ended associations. A single-ended assocation is a one-to-one or many-to-one assocation. A value of 0 disables default outer join fetching.
hibernate.default_batch_fetch_size

4,8, or 16

Default size for Hibernate batch fetching of associations.
hibernate.default_entity_mode

dynamic-map or pojo

Default mode for entity representation for all sessions opened from this SessionFactory, defaults to pojo.
hibernate.order_updates

true or false

Forces Hibernate to order SQL updates by the primary key value of the items being updated. This reduces the likelihood of transaction deadlocks in highly-concurrent systems.
hibernate.order_by.default_null_ordering

none, first or last

Defines precedence of null values in ORDER BY clause. Defaults to none which varies between RDBMS implementation.
hibernate.generate_statistics

true or false

Causes Hibernate to collect statistics for performance tuning.
hibernate.use_identifier_rollback

true or false

If true, generated identifier properties are reset to default values when objects are deleted.
hibernate.use_sql_comments

true or false

If true, Hibernate generates comments inside the SQL, for easier debugging.

Table A.2. Cache Properties

PropertyExamplePurpose
hibernate.cache.provider_classFully-qualified classnameThe classname of a custom CacheProvider.
hibernate.cache.use_minimal_puts

true or false

Optimizes second-level cache operation to minimize writes, at the cost of more frequent reads. This is most useful for clustered caches and is enabled by default for clustered cache implementations.
hibernate.cache.use_query_cache

true or false

Enables the query cache. You still need to set individual queries to be cachable.
hibernate.cache.use_second_level_cache

true or false

Completely disable the second level cache, which is enabled by default for classes which specify a <cache> mapping.
hibernate.cache.query_cache_factoryFully-qualified classnameA custom QueryCache interface. The default is the built-in StandardQueryCache.
hibernate.cache.region_prefixA stringA prefix for second-level cache region names.
hibernate.cache.use_structured_entries

true or false

Forces Hibernate to store data in the second-level cache in a more human-readable format.
hibernate.cache.auto_evict_collection_cache

true or false (default: false)

Enables the automatic eviction of a bi-directional association's collection cache when an element in the ManyToOne collection is added/updated/removed without properly managing the change on the OneToMany side.
hibernate.cache.use_reference_entries

true or false

Optimizes second-level cache operation to store immutable entities (aka "reference") which do not have associations into cache directly, this case, lots of disasseble and deep copy operations can be avoid. Default value of this property is false.


Note

Each of the properties in the following table are prefixed by hibernate.. It has been removed in the table to conserve space.


c3p0 connection pool properties

  • hibernate.c3p0.min_size

  • hibernate.c3p0.max_size

  • hibernate.c3p0.timeout

  • hibernate.c3p0.max_statements