Pete:
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.
Maybe I don't understand this because I am not a native English speaker;).
Will your proposal support something like this:
public class ModificationListener {
@Inject
@Current
private User user;
@PrePersist
public void onCreate(Object obj) {
if (obj instanceof ModifiableObject) {
// make use of current user
}
}
}
Right now I have use the BeanManager within the listener to achieve the
same result. Pretty inconvenient.
Jens
On 21.06.11 15:54 "Pete Muir" <pmuir(a)bleepbleep.org.uk> wrote:
FYI
Begin forwarded message:
> From: Pete Muir <pmuir(a)redhat.com>
> Date: 21 June 2011 14:53:57 GMT+01:00
> To: Werner Keil <werner.keil(a)gmail.com>
> Cc: users(a)javaee-spec.java.net
> Subject: Re: [jsr338-experts] Integration of EntityListeners Classes
>with CDI (Java EE 7)
>
> Thanks Werner. I'll forward to the CDI EG (address is
>cdi-dev(a)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(a)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(a)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
>>
>
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev