[
https://issues.apache.org/jira/browse/OPENJPA-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18152486#comment-18152486
]
ASF subversion and git services commented on OPENJPA-3102:
----------------------------------------------------------
Commit 1b385084d958190c6a11b7c127f49e639542f836 in openjpa's branch
refs/heads/OPENJPA-3101 from Paulo Cristovão de Araújo Silva Filho
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=1b385084d ]
[OPENJPA-3101] Refactored CDI support
* CDI support is ruled by a single factory - BeanWrapperFactory
* Kept default stateless, non-CDI behavior for both EntityListener and
AttributeConverter
* Added support of Jakarta EE bean manager variable (OPENJPA-3102)
* Updated documentation to reflect the new factory configuration
> Use the BeanManager passed in jakarta.persistence.bean.manager for CDI entity
> listeners
> ---------------------------------------------------------------------------------------
>
> Key: OPENJPA-3102
> URL: https://issues.apache.org/jira/browse/OPENJPA-3102
> Project: OpenJPA
> Issue Type: Bug
> Components: kernel
> Reporter: Richard Zowalla
> Assignee: Richard Zowalla
> Priority: Major
> Fix For: 4.3.0
>
>
> The CDI support for entity listeners from OPENJPA-3089 looks up the
> BeanManager through JNDI ({{java:comp/BeanManager}},
> {{java:comp/env/BeanManager}}) and then {{CDI.current()}}
> ({{EntityListenerCDIFactory}}). It does not use the BeanManager the container
> passes in the property {{jakarta.persistence.bean.manager}}.
> The spec defines that property as the source of the BeanManager: sections
> 3.6.1 (entity listeners) and 3.9 (attribute converters) both start with
> "Obtain a BeanManager instance. (See Section 9.1)", and 9.1 says: "The
> container is responsible for passing this BeanManager instance via the map
> that is passed as an argument to the createContainerEntityManagerFactory
> call. The map key used must be the standard property name
> jakarta.persistence.bean.manager." The javadoc of
> {{PersistenceProvider.createContainerEntityManagerFactory}} says the same.
> TomEE passes it ({{EntityManagerFactoryCallable}}) as a lazy proxy, because
> the EMF is often created before CDI is started for the application. Without
> the property the lookup can happen before CDI is available, or find the
> BeanManager of another context, and injection is then silently off.
> Use the BeanManager from {{jakarta.persistence.bean.manager}} when it is set,
> and only fall back to JNDI and {{CDI.current()}} otherwise. OPENJPA-3101
> (attribute converters) reuses this setup.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)