[cdi-dev] [JBoss JIRA] Commented: (CDI-144) Support Injection into Entity Listeners

Mark Struberg (JIRA) jira-events at lists.jboss.org
Mon Jul 25 03:27:23 EDT 2011


    [ https://issues.jboss.org/browse/CDI-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616107#comment-12616107 ] 

Mark Struberg commented on CDI-144:
-----------------------------------

uuhhh, not sure if we like to do that. This idea is around since quite a time, but please remember that EntityListeners might get called often, VERY OFTEN! You really might completely trash the performance of any JPA provider that way!

Consider a @PostLoad EntityListener. It might be convenient in some cases, but in _most_ cases it's just a runtime overhead which slows down your app. 
 
Also the JPA spec doesn't define extension points, so this would be heavily provider dependent. It would get hard to exchange the JPA implementation of a server. The JPA spec also doesn't define any need for using AnnotatedType instead of the class annotations itself. So this would not be as convenient as it looks at the first glance I fear.

There are easy ways to lookup the BeanManager inside any EntityListener and get your contextual references that way.


> Support Injection into Entity Listeners
> ---------------------------------------
>
>                 Key: CDI-144
>                 URL: https://issues.jboss.org/browse/CDI-144
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>            Reporter: Cody Lerum
>
> It would be very convenient if CDI was available inside JPA Entity Listeners. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the cdi-dev mailing list