users@glassfish.java.net

Re: CDI broken between EJB and JPA modules

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Apr 2010 10:26:01 PDT

Hi,
I'm using persince + ejb packaged in one archive with dao injected into stateles EJB, two most important things to make it work:
- there should be persistence.xml packaged in to META-INF
- there should be beans.xml in META-INF to make the CDI work

Dao is not annotated in any way (so the dao objects have "dependent" scope).
Dao are injected to EJB by using:

  @Inject
   ClusterDao clusterDao;

where ClusterDao is interface (and there is only one class implementing this interface),
This works on embedded and normal glassfish v3 (stable).
[Message sent by forum member 'jszczepankiewicz']

http://forums.java.net/jive/thread.jspa?messageID=395971