Hi,
I would like to discuss this CDI/JPA issue to see if we can get
consensus for handling the cycle.
The [1] issue is that entity listeners support CDI injection and the
injected bean may in turn reference the same persistence unit, which can
cause a cycle if the entity listener is registered before the
persistence unit is deployed.
One way to resolve the cycle, is to ensure that persistence units are
available before entity listeners are registered.
This issue came up originally as [2]. If you read nothing else in [2],
at least read comment [2] which explains the expectation for this to work.
For JPA 2.2, I would like to discuss having all compliant persistence
providers agree to a contract, that defers registration of the entity
listener until it is first needed (e.g. first time that entity listener
callback needs to be called).
Another option would be to explicitly disallow applications from using
this form of self references.
Do any persistence providers already do lazy registration of the entity
listener?
Thanks,
Scott
[1]
https://java.net/jira/browse/JPA_SPEC-83
[2]
https://issues.jboss.org/browse/WFLY-2387
[3]
https://issues.jboss.org/browse/WFLY-2387?focusedCommentId=12938120&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12938120