[
https://issues.jboss.org/browse/CDI-144?page=com.atlassian.jira.plugin.sy...
]
Jens Schumann edited comment on CDI-144 at 8/22/12 11:49 AM:
-------------------------------------------------------------
Since I have been running into this issue lately: JPA does not recommend EntityManager
interactions within JPA lifecycle callbacks*. Shouldn't we add a note somewhere that
injected resources require special attention regarding JPA compliance? And because of that
firing CDI events from a JPA entity listener is particularly dangerous?
In my case I tried to implement global available created/updated/deleted entity events
which turned out to be an bad idea if implemented on EntityListener level.
\\* JPA Spec 3.5.2: In general, the lifecycle method of a portable application should not
invoke EntityManager or Query operations, access other entity instances, or modify
relationships within the same persistence context.[45] A lifecycle callback method may
modify the non-relationship state of the entity on which it is invoked.
was (Author: french_c):
Since I have been running into this issue lately: JPA does not recommend EntityManager
interactions within JPA lifecycle callbacks*. Shouldn't we add a note somewhere that
injected resources require special attention regarding JPA compliance? And because of that
firing CDI events from a JPA entity listener is particularly dangerous?
In my case I tried to implement global available created/updated/deleted entity events
which turned out to be an bad idea if implemented on EntityListener level.
* JPA Spec 3.5.2: In general, the lifecycle method of a portable application should not
invoke EntityManager or Query operations, access other entity instances, or modify
relationships within the same persistence context.[45] A lifecycle callback method may
modify the non-relationship state of the entity on which it is invoked.
Support Injection into Entity Listeners
---------------------------------------
Key: CDI-144
URL:
https://issues.jboss.org/browse/CDI-144
Project: CDI Specification Issues
Issue Type: Tracker
Affects Versions: 1.0
Reporter: Cody Lerum
Assignee: Pete Muir
Fix For: 1.1 (Proposed)
It would be very convenient if CDI was available inside JPA Entity Listeners.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira