3.28. Hibernate properties for JPA

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

Since 4.3 version, eXo Platform uses Java Persistance API (JPA) to manage relational data and Hibernate as a JPA provider.

In tis section, we will define properties allowing to configure Hibernate in eXo Platform. The following properties should be set in exo.properties file.

NameDescriptionValue
General configuration
exo.jpa.hibernate.dialectThe classname of a Hibernate org.hibernate.dialect.DialectA fully-qualified classname for example for HSQl database it is org.hibernate.dialect.HSQLDialect
exo.jpa.hibernate.show_sqlEnables/disables log about SQL statements.true or false
exo.jpa.hibernate.format_sqlFormat log about SQL statements.true or false
exo.jpa.hibernate.default_schemaThe schema name.${gatein.idm.datasource.schema:}
exo.jpa.hibernate.default_catalogThe catalog name, it qualifies unqualified table names with the given catalog in generated SQL. 
exo.jpa.hibernate.session_factory_nameThe org.hibernate.SessionFactory is automatically bound to this name in JNDI after it is created.JNDI name
exo.jpa.hibernate.max_fetch_depthSets 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.A value between 0 and 3
exo.jpa.hibernate.default_batch_fetch_sizeDefault size for Hibernate batch fetching of associations.4,8 or 16
exo.jpa.hibernate.default_entity_modeDefault mode for entity representation for all sessions opened from this SessionFactory, defaults to pojo.dynamic-map or pojo
exo.jpa.hibernate.order_updatesForces 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.true or false
exo.jpa.hibernate.order_by.default_null_orderingDefines precedence of null values in ORDER BY clause. Defaults to none which varies between RDBMS implementation.none, first or last
exo.jpa.hibernate.generate_statisticsCauses Hibernate to collect statistics for performance tuning.true or false
exo.jpa.hibernate.use_identifier_rollbackf true, generated identifier properties are reset to default values when objects are deleted.true or false
exo.jpa.hibernate.use_sql_commentsIf true, Hibernate generates comments inside the SQL, for easier debugging.true or false
Database configuration: JDBC
exo.jpa.hibernate.jdbc.fetch_sizeA non-zero value determines the JDBC fetch size, by calling Statement.setFetchSize().An integer or 0
exo.jpa.hibernate.jdbc.batch_sizeA non-zero value causes Hibernate to use JDBC2 batch updates.A value between 5 and 30
exo.jpa.hibernate.jdbc.batch_versioned_dataSet this property to true if your JDBC driver returns correct row counts from executeBatch(). This option is usually safe, but is disabled by default. If enabled, Hibernate uses batched DML for automatically versioned data.true or false
exo.jpa.hibernate.jdbc.factory_classSelect a custom org.hibernate.jdbc.Batcher. Irrelevant for most applications.The fully-qualified class name of the factory
exo.jpa.hibernate.jdbc.use_scrollable_resultsetEnables Hibernate to use JDBC2 scrollable resultsets. This property is only relevant for user-supplied JDBC connections. Otherwise, Hibernate uses connection metadata.true or false
exo.jpa.hibernate.jdbc.use_streams_for_binaryUse streams when writing or reading binary or serializable types to or from JDBC. This is a system-level property.true or false
exo.jpa.hibernate.jdbc.use_get_generated_keysAllows Hibernate to use JDBC3 PreparedStatement.getGeneratedKeys() to retrieve natively-generated keys after insert. You need the JDBC3+ driver and JRE1.4+. Disable this property if your driver has problems with the Hibernate identifier generators. By default, it tries to detect the driver capabilities from connection metadata.true or false
Database configuration: Cache properties
exo.jpa.hibernate.cache.provider_classThe classname of a custom CacheProvider.org.hibernate.cache.HashtableCacheProvider
exo.jpa.hibernate.cache.use_minimal_putsOptimizes 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.true or false
exo.jpa.hibernate.cache.use_query_cacheEnables the query cache. You still need to set individual queries to be cachable.true or false
exo.jpa.hibernate.cache.use_second_level_cacheCompletely disable the second level cache, which is enabled by default for classes which specify a cache mapping.true or false
exo.jpa.hibernate.cache.query_cache_factoryA custom QueryCache interface. The default is the built-in StandardQueryCache.Fully-qualified classname
exo.jpa.hibernate.cache.region_prefixA prefix for second-level cache region names.a string
exo.jpa.hibernate.cache.use_structured_entriesForces Hibernate to store data in the second-level cache in a more human-readable format.true or false
exo.jpa.hibernate.cache.use_reference_entriesOptimizes second-level cache operation to store immutable entities (aka "reference") which do not have associations into cache directly, this case, lots of disassemble and deep copy operations could be avoided. Default value of this property is false. true or false
Database configuration: Transactions properties
exo.jpa.hibernate.transaction.factory_classThe classname of a TransactionFactory to use with Hibernate Transaction API. The default is JDBCTransactionFactory.org.hibernate.transaction.JTATransactionFactory
exo.jpa.hibernate.jta.UserTransactionThe JTATransactionFactory needs a JNDI name to obtain the JTA UserTransaction from the application server.a JNDI name
exo.jpa.hibernate.transaction.manager_lookup_classThe classname of a TransactionManagerLookup, which is used in conjunction with JVM-level or the hilo generator in a JTA environment.org.hibernate.transaction.JBossTransactionManagerLookup
exo.jpa.hibernate.transaction.flush_before_completionCauses the session be flushed during the before completion phase of the transaction. If possible, use built-in and automatic session context management instead.true or false
exo.jpa.hibernate.transaction.auto_close_sessionCauses the session to be closed during the after completion phase of the transaction. If possible, use built-in and automatic session context management instead.true or false
Database configuration: Miscellaneous properties
exo.jpa.current_session_context_classSupply a custom strategy for the scoping of the Current Session.jta, thread, managed, or custom.Class
exo.jpa.factory_classChooses the HQL parser implementation.org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory or org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory
exo.jpa.query.substitutionsMap from tokens in Hibernate queries to SQL tokens, such as function or literal names.hqlLiteral=SQL_LITERAL or hqlFunction=SQLFUNC
exo.jpa.hbm2ddl.autoValidates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema is dropped when the SessionFactory is closed explicitly.validate, update, create, create-drop
Connection pool properties
exo.jpa.hibernate.proxool.xmlConfigure Proxool provider using an XML file (.xml is appended automatically) 
exo.jpa.hibernate.proxool.propertiesConfigure the Proxool provider using a properties file (.properties is appended automatically) 
exo.jpa.hibernate.proxool.existing_poolWhether to configure the Proxool provider from an existing pool. 
exo.jpa.hibernate.proxool.pool_aliasProxool pool alias to use. Required. 
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus