Package org.jboss.as.jpa.hibernate5
Class HibernateExtendedBeanManager
- java.lang.Object
-
- org.jboss.as.jpa.hibernate5.HibernateExtendedBeanManager
-
- All Implemented Interfaces:
org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager,org.hibernate.resource.beans.container.spi.ExtendedBeanManager
public class HibernateExtendedBeanManager extends Object implements org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager
HibernateExtendedBeanManager helps defer the registering of entity listeners, with the Jakarta Contexts and Dependency Injection BeanManager until after the persistence unit is available for lookup by Jakarta Contexts and Dependency Injection bean(s). This solves the WFLY-2387 issue of Jakarta Persistence entity listeners referencing the Jakarta Contexts and Dependency Injection bean, when the bean cycles back to the persistence unit, or a different persistence unit.- Author:
- Scott Marlow
-
-
Constructor Summary
Constructors Constructor Description HibernateExtendedBeanManager(javax.enterprise.inject.spi.BeanManager beanManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeanManagerIsAvailableForUse()voidregisterLifecycleListener(org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager.LifecycleListener lifecycleListener)Hibernate calls registerLifecycleListener to register N callbacks to be notified when the Jakarta Contexts and Dependency Injection BeanManager can safely be used.
-
-
-
Method Detail
-
registerLifecycleListener
public void registerLifecycleListener(org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager.LifecycleListener lifecycleListener)
Hibernate calls registerLifecycleListener to register N callbacks to be notified when the Jakarta Contexts and Dependency Injection BeanManager can safely be used. The Jakarta Contexts and Dependency Injection BeanManager can safely be used when the Jakarta Contexts and Dependency Injection AfterDeploymentValidation event is reached.- Specified by:
registerLifecycleListenerin interfaceorg.hibernate.jpa.event.spi.jpa.ExtendedBeanManager- Parameters:
lifecycleListener- Note: Caller (BeanManagerAfterDeploymentValidation) is expected to synchronize calls to registerLifecycleListener() + beanManagerIsAvailableForUse(), which protects HibernateExtendedBeanManager.lifecycleListeners from being read/written from multiple concurrent threads. There are many writer threads (one per deployed persistence unit) and one reader/writer thread expected to be triggered by one AfterDeploymentValidation event per deployment.
-
beanManagerIsAvailableForUse
public void beanManagerIsAvailableForUse()
-
-