users@javaee-spec.java.net

[javaee-spec users] Fwd: [jsr338-experts] Integration of EntityListeners Classes with CDI (Java EE 7)

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Tue, 21 Jun 2011 14:57:31 +0100

Thanks Werner. I'll forward to the CDI EG (address is cdi-dev_at_lists.jboss.org).

I don't think you should be able to make an EntityListener into a bean, as the listener is stateless, there is little point in being able to inject it into another bean. Instead, I would propose that EntityListeners are simply added to the list of Java EE components which are able to be injected. This means they can be injected, but are not available for injection into other components.

On 21 Jun 2011, at 14:48, Werner Keil wrote:

> Forwarding it to other aliases and Pete (although there must be a CDI 1.1 alias by now, too<347.gif>)
>
> ---------- Forwarded message ----------
> From: Adam Bien <abien_at_adam-bien.com>
> Date: Tue, Jun 21, 2011 at 5:48 PM
> Subject: [jsr338-experts] Integration of EntityListeners Classes with CDI (Java EE 7)
> To: jsr338-experts_at_jpa-spec.java.net
>
>
> Hi *
>
> EntityListeners should be integrated with CDI / EJB 3.2. It means: Java EE 7 DI should work in EntityListener classes. An EntityListener could be annotated with @Singleton / @Stateless / @RequestScoped etc. (everything what is stateless)
>
> We should extend the sentence: "Entity listeners are stateless. The lifecycle of an entity listener is unspecified" at the page 95 of the Expert Group Draft 2. to "The lifecycle of an entity listener is unspecified in unmanaged environments. An EJB 3.2 @Stateless, @Singleton or CDI managed bean can also receive callback events",
>
> What do you think?
>
> adam
>
>
>
> --
> Werner Keil | UOMo Lead | Eclipse Foundation | Agile Coach, Principal Consultant | emergn limited
> 590 Madison Avenue. New York. NY 10022 | 68 Lombard Street. London EC3V 9LJ UK
> US Toll Free: +1-877.964.1981 | Worldwide Toll Free: +800.225.53482
> Twitter @wernerkeil | Skype: werner.keil | www.emergn.com | Reshaping IT
>