Top Fields
org.hibernate.cfg

public Interface ManagedBeanSettings

Known Direct Subinterfaces
org.hibernate.cfg.AvailableSettings

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final String
ALLOW_EXTENSIONS_IN_CDI

Controls whether Hibernate can try to create beans other than converters and listeners using CDI.

public static final String
public static final String
public static final String
DELAY_CDI_ACCESS

Used in conjunction with hibernate.resource.beans.container when CDI is used.

public static final String

Field Detail

ALLOW_EXTENSIONS_IN_CDIback to summary
public static final String ALLOW_EXTENSIONS_IN_CDI

Controls whether Hibernate can try to create beans other than converters and listeners using CDI. Only meaningful when a CDI container is used.

By default, Hibernate will only attempt to create converter and listener beans using CDI.

Since
6.2
BEAN_CONTAINERback to summary
public static final String BEAN_CONTAINER

Identifies a org.hibernate.resource.beans.container.spi.BeanContainer to be used.

Note that for CDI-based containers setting this is not necessary - simply pass the jakarta.enterprise.inject.spi.BeanManager to use via CDI_BEAN_MANAGER and optionally specify DELAY_CDI_ACCESS. This setting useful to integrate non-CDI bean containers such as Spring.

Since
5.3
CDI_BEAN_MANAGERback to summary
public static final String CDI_BEAN_MANAGER

Deprecated

Use JAKARTA_CDI_BEAN_MANAGER instead

Annotations
@Deprecated
DELAY_CDI_ACCESSback to summary
public static final String DELAY_CDI_ACCESS

Used in conjunction with hibernate.resource.beans.container when CDI is used.

By default, to be JPA spec compliant, Hibernate should access the CDI jakarta.enterprise.inject.spi.BeanManager while bootstrapping the org.hibernate.SessionFactory. In some cases however this can lead to a chicken/egg situation where the JPA provider immediately accesses the BeanManager when managed beans are awaiting JPA PU injection.

This setting tells Hibernate to delay accessing until first use.

This setting has the decided downside that bean config problems will not be done at deployment time, but will instead manifest at runtime. For this reason, the preferred means for supplying a CDI BeanManager is to provide an implementation of org.hibernate.resource.beans.container.spi.ExtendedBeanManager which gives Hibernate a callback when the BeanManager is ready for use.

Since
5.0.8
JAKARTA_CDI_BEAN_MANAGERback to summary
public static final String JAKARTA_CDI_BEAN_MANAGER

Used to pass a CDI jakarta.enterprise.inject.spi.BeanManager to Hibernate.

According to the JPA specification, the BeanManager should be passed at boot time and be ready for immediate use at that time. But not all environments can do this (WildFly, for example). To accommodate such environments, Hibernate provides two options:

  1. A proprietary CDI extension SPI (which has been proposed to the CDI spec group as a standard option) which can be used to provide delayed BeanManager access: to use this solution, the reference passed as the BeanManager during bootstrap should be typed as org.hibernate.resource.beans.container.spi.ExtendedBeanManager.
  2. Delayed access to the BeanManager reference: here, Hibernate will not access the reference passed as the BeanManager during bootstrap until it is first needed. Note, however, that this has the effect of delaying the detection of any deployment problems until after bootstrapping.
This setting is used to configure access to the BeanManager, either directly, or via org.hibernate.resource.beans.container.spi.ExtendedBeanManager.
See Also
org.hibernate.boot.SessionFactoryBuilder#applyBeanManager(Object)