I really don't fully understand how the Hibernate javax.enterprise.inject.spi.Extension implementation is found in all EE environments, but it might be. For non-EE environments that are CDI enabled but do not have visibility to the Hibernate javax.enterprise.inject.spi.Extension implementation, I wonder if we should have a configuration setting for specifying when/how the entity listeners should be registered (e.g. eager/lazy/CDI). I pushed a hack to https://github.com/scottmarlow/hibernate-orm/tree/HHH-8706. The BeanManagerAfterDeploymentValidation is being called, however, its not integrated to actually be used yet. I also hacked BeanManagerListenerFactory.buildListener(Class<T> listenerClass) to do the deferred bean manager setup. Steve Ebersole let me know if you would like to work on this jira, I know that you understand the entity listener registration better than me . |