Skip to content

Commit da5aae7

Browse files
committed
Add JPA-related configuration properties in the new User Guide
1 parent 985229f commit da5aae7

File tree

1 file changed

+55
-10
lines changed

1 file changed

+55
-10
lines changed

documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ Note that for backwards compatibility, if a `org.hibernate.context.spi.CurrentSe
4747
[width="100%",cols="20%,20%,60%",]
4848
|===================================================================================================================================================================================================================================
4949
|Property |Example |Purpose
50-
|`hibernate.connection.driver_class` | `org.postgresql.Driver` | Names the JDBC `Driver` class name.
51-
|`hibernate.connection.url` | `jdbc:postgresql:hibernate_orm_test` | Names the JDBC connection URL.
52-
|`hibernate.connection.username` | | Names the JDBC connection user name.
53-
|`hibernate.connection.password` | | Names the JDBC connection password.
50+
|`hibernate.connection.driver_class` or `javax.persistence.jdbc.driver` | `org.postgresql.Driver` | Names the JDBC `Driver` class name.
51+
|`hibernate.connection.url` or `javax.persistence.jdbc.url` | `jdbc:postgresql:hibernate_orm_test` | Names the JDBC connection URL.
52+
|`hibernate.connection.username` or `javax.persistence.jdbc.user` | | Names the JDBC connection user name.
53+
|`hibernate.connection.password` or `javax.persistence.jdbc.password` | | Names the JDBC connection password.
5454
|`hibernate.connection.isolation` | `REPEATABLE_READ` or
5555
`Connection.TRANSACTION_REPEATABLE_READ` | Names the JDBC connection transaction isolation level.
5656
|`hibernate.connection.autocommit` | `true` or `false` (default value) | Names the JDBC connection autocommit mode.
@@ -229,19 +229,33 @@ Default is `hbm,class"` which indicates to process `hbm.xml` files followed by a
229229
|`hibernate.use_nationalized_character_data` |`true` or `false` (default value) |Enable nationalized character support on all string / clob based attribute ( string, char, clob, text etc ).
230230
|`hibernate.jdbc.lob.non_contextual_creation` |`true` or `false` (default value) |Should we not use contextual LOB creation (aka based on `java.sql.Connection#createBlob()` et al)? The default value for HANA, H2, and PostgreSQL is `true`.
231231

232-
3+|Misc options
232+
3+|Bean Validation options
233+
|`javax.persistence.validation.factory` |`javax.validation.ValidationFactory` implementation | Specify the `javax.validation.ValidationFactory` implementation to use for Bean Validation.
233234
|`hibernate.check_nullability` |`true` or `false` |
234235

235236
Enable nullability checking. Raises an exception if a property marked as not-null is null.
236237

237238
Default to `false` if Bean Validation is present in the classpath and Hibernate Annotations is used, `true` otherwise.
238239

239-
|`hibernate.bytecode.provider` |`javassist` (default value) | The `org.hibernate.bytecode.spi.BytecodeProvider` built-in implementation flavor. Currently, only `javassist` is supported.
240+
3+|Misc options
240241
|`hibernate.create_empty_composites.enabled` |`true` or `false` (default value) | Enable instantiation of composite/embeddable objects when all of its attribute values are `null`. The default (and historical) behavior is that a `null` reference will be used to represent the composite when all of its attributes are `null`.
241242
|`hibernate.entity_dirtiness_strategy` | fully-qualified class name or an actual `CustomEntityDirtinessStrategy` instance | Setting to identify a `org.hibernate.CustomEntityDirtinessStrategy` to use.
242243
|`hibernate.default_entity_mode` |`pojo` (default value) or `dynamic-map` |Default `EntityMode` for entity representation for all sessions opened from this `SessionFactory`, defaults to `pojo`.
243244
|===================================================================================================================================================================================================================================
244245

246+
[[configurations-bytecode-enhancement]]
247+
=== Bytecode Enhancement Properties
248+
249+
[width="100%",cols="20%,20%,60%",]
250+
|===================================================================================================================================================================================================================================
251+
|Property |Example |Purpose
252+
|`hibernate.enhancer.enableDirtyTracking`| `true` or `false` (default value) | Enable dirty tracking feature in runtime bytecode enhancement.
253+
|`hibernate.enhancer.enableLazyInitialization`| `true` or `false` (default value) | Enable lazy loading feature in runtime bytecode enhancement. This way, even basic types (e.g. `@Basic(fetch = FetchType.LAZY`)) can be fetched lazily.
254+
|`hibernate.enhancer.enableAssociationManagement`| `true` or `false` (default value) | Enable association management feature in runtime bytecode enhancement which automatically synchronizes a bidirectional association when only one side is changed.
255+
|`hibernate.bytecode.provider` |`javassist` (default value) | The `org.hibernate.bytecode.spi.BytecodeProvider` built-in implementation flavor. Currently, only `javassist` is supported.
256+
|`hibernate.bytecode.use_reflection_optimizer`| `true` or `false` (default value) | Should we use reflection optimization? The reflection optimizer implements the `org.hibernate.bytecode.spi.ReflectionOptimizer` interface and improves entity instantiation and property getter/setter calls.
257+
|===================================================================================================================================================================================================================================
258+
245259
[[configurations-query]]
246260
=== Query settings
247261

@@ -355,7 +369,8 @@ In reality, you shouldn't probably enable this setting anyway.
355369
|`hibernate.generate_statistics` |`true` or `false` |Causes Hibernate to collect statistics for performance tuning.
356370
|`hibernate.session.events.log` |`true` or `false` |
357371

358-
A setting to control whether to `org.hibernate.engine.internal.StatisticalLoggingSessionEventListener` is enabled on all `Sessions` (unless explicitly disabled for a given `Session`).
372+
A setting to control whether to `org.hibernate.engine.internal
373+
.StatisticalLoggingSessionEventListener` is enabled on all `Sessions` (unless explicitly disabled for a given `Session`).
359374
The default value of this setting is determined by the value for `hibernate.generate_statistics`, meaning that if collection of statistics is enabled logging of Session metrics is enabled by default too.
360375

361376
|===================================================================================================================================================================================================================================
@@ -381,6 +396,10 @@ Setting used to give the name of the default `org.hibernate.annotations.CacheCon
381396
|`hibernate.cache.use_structured_entries` |`true` or `false` (default value) |Forces Hibernate to store data in the second-level cache in a more human-readable format.
382397
|`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.
383398
|`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`.
399+
|`hibernate.ejb.classcache`| `hibernate.ejb.classcache
400+
.org.hibernate.ejb.test.Item` = `read-write` | Sets the associated entity class cache concurrency strategy for the designated region. Caching configuration should follow the following pattern `hibernate.ejb.classcache.<fully.qualified.Classname>` usage[, region] where usage is the cache strategy used and region the cache region name.
401+
|`hibernate.ejb.collectioncache`| `hibernate.ejb.collectioncache
402+
.org.hibernate.ejb.test.Item.distributors` = `read-write, RegionName`/> | Sets the associated collection cache concurrency strategy for the designated region. Caching configuration should follow the following pattern `hibernate.ejb.collectioncache.<fully.qualified.Classname>.<role>` usage[, region] where usage is the cache strategy used and region the cache region name
384403
|==================================================================================================================================================================================================================================================================================================================
385404

386405
[[configurations-transactions]]
@@ -604,7 +623,7 @@ Therefore, the `org.hibernate.tool.hbm2ddl.UniqueConstraintSchemaUpdateStrategy`
604623
|===========================================================================================================================
605624
|Property |Example |Purpose
606625
|`hibernate.session.events.auto` | | Fully qualified class name implementing the `SessionEventListener` interface.
607-
|`hibernate.session_factory.interceptor` | `org.hibernate.EmptyInterceptor` (default value) a|
626+
|`hibernate.session_factory.interceptor` or `hibernate.ejb.interceptor` | `org.hibernate.EmptyInterceptor` (default value) a|
608627

609628
Names a `org.hibernate.Interceptor` implementation to be applied to every `Session` created by the current `org.hibernate.SessionFactory`
610629

@@ -613,6 +632,14 @@ Can reference:
613632
* `Interceptor` instance
614633
* `Interceptor` implementation `Class` object reference
615634
* `Interceptor` implementation class name
635+
636+
|`hibernate.ejb.interceptor.session_scoped` | fully-qualified class name or class reference | An optional Hibernate interceptor.
637+
638+
The interceptor instance is specific to a given Session instance (and hence is not thread-safe) has to implement `org.hibernate.Interceptor` and have a no-arg constructor.
639+
640+
This property can not be combined with `hibernate.ejb.interceptor`.
641+
|`hibernate.ejb.session_factory_observer` | fully-qualified class name or class reference | Specifies a `SessionFactoryObserver` to be applied to the SessionFactory. The class must have a no-arg constructor.
642+
|`hibernate.ejb.event` | `hibernate.ejb.event.pre-load` = `com.acme.SecurityListener,com.acme.AuditListener` | Event listener list for a given event type. The list of event listeners is a comma separated fully qualified class name list.
616643
|===========================================================================================================================
617644

618645
[[configurations-jmx]]
@@ -667,11 +694,29 @@ Naming the `SessionFactory` allows for it to be properly serialized across JVMs
667694

668695
If `hibernate.session_factory_name_is_jndi` is set to `true`, this is also the name under which the `SessionFactory` is bound into JNDI on startup and from which it can be obtained from JNDI.
669696

670-
|`hibernate.session_factory_name_is_jndi` |`true` (default value) |
697+
|`hibernate.session_factory_name_is_jndi` |`true` (default value) or `false` |
671698

672699
Does the value defined by `hibernate.session_factory_name` represent a JNDI namespace into which the `org.hibernate.SessionFactory` should be bound and made accessible?
673700

674701
Defaults to `true` for backwards compatibility. Set this to `false` if naming a SessionFactory is needed for serialization purposes, but no writable JNDI context exists in the runtime environment or if the user simply does not want JNDI to be used.
675702

676-
|`hibernate.bytecode.use_reflection_optimizer`| `true` or `false` (default value) | Should we use reflection optimization? The reflection optimizer implements the `org.hibernate.bytecode.spi.ReflectionOptimizer` interface and improves entity instantiation and property getter/setter calls.
703+
|`hibernate.ejb.entitymanager_factory_name`| By default, the persistence unit name is used, otherwise a randomly generated UUID | Internally, Hibernate keeps track of all `EntityManagerFactory` instances using the `EntityManagerFactoryRegistry`. The name is used as a key to identify a given `EntityManagerFactory` reference.
704+
|`hibernate.ejb.cfgfile`| `hibernate.cfg.xml` (default value) | XML configuration file to use to configure Hibernate.
705+
|`hibernate.ejb.discard_pc_on_close`| `true` or `false` (default value) |
706+
707+
If true, the persistence context will be discarded (think `clear()` when the method is called.
708+
Otherwise, the persistence context will stay alive till the transaction completion: all objects will remain managed, and any change will be synchronized with the database (default to false, ie wait for transaction completion).
709+
710+
|`hibernate.ejb.metamodel.population`| `enabled` or `disabled`, or `ignoreUnsupported` (default value) a|
711+
712+
Setting that controls whether we seek out JPA _static metamodel_ classes and populate them.
713+
714+
Accepts three values:
715+
716+
enabled:: Do the population
717+
disabled:: Do not do the population
718+
ignoreUnsupported:: Do the population, but ignore any non-JPA features that would otherwise result in the population failing (e.g. `@Any` annotation).
719+
720+
|`hibernate.delay_cdi_access`| `true` or `false` (default value) | Defines delayed access to CDI `BeanManager`. Starting in 5.1 the preferred means for CDI bootstrapping is through `org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager`.
677721
|=====================================================================================================================================================================================================================================================
722+

0 commit comments

Comments
 (0)