javaee-samples/javaee7-samples — pull request #201 by kubamarchwicki (2014-02-01 15:26:44+00:00)
Title: JPA listener injection test

Sample for JPA Listener injection. This works neatly, however...

> From the Proposed Final Draft of the JPA 2.1 spec, page 96:
>> Entity listener classes in Java EE environments support dependency injection
>> through the Contexts and Dependency Injection API (CDI) [ 10 ] when the
>> containing archive is a bean archive. An entity listener class that makes use of CDI
>> injection may also define lifecycle callback methods annotated with the PostConstruct
>> and PreDestroy annotations. These methods will be invoked after injection has taken
>> place and before the entity listener instance is destroyed respectively

Only `@Stateless` and `@EJB` pair worked for me (tested wildfly CR1), while I'd expect `@Named` and `@Inject` should be working as well. That left be a bit puzzled but the sample shows the case.