0 Replies Latest reply on Aug 11, 2015 9:21 PM by kalai selvan

    Injecting EntityRepository

    kalai selvan Newbie

      I am working on migrating a project to deltaspike & WildFly. It has a web module, ejb module and multiple submodules. One of the submodule A,  has Entity and EntityRepository. I am trying to inject it into another submodule B. Injection fails and I am getting NPE.

      During startup, Servlet in webmodule call a RepositoryFactory(spring factory) in Module B to create repository, which has EntityRepository from module A injected.

      This is my ear structure.





      | |_Application.xml





        |_Module A

        | |_Entity

        | |_EntityRepository

        |_Module B








      public class WfNamedQueryRef implements Serializable {








      public abstract class WfNamedQueryRefEntityRepository implements EntityRepository<WfNamedQueryRef, Integer>, EntityManagerDelegate<WfNamedQueryRef> {




      Other bean where I am trying to inject



      public class NamedQueryRepository extends AbstractNamedQueryRepository {

        private Logger logger = LoggerFactory.getLogger(this.getClass().getName());



        private WfNamedQueryRefEntityRepository namedQueryRepo;



        List<WfNamedQueryRef> list = namedQueryRepo.findAll();




      I have beans.xml in META-INF folder in each submodule and also in WEB-INF folder in WebModule.


      In the log during startup I see ClassDeActivationUtils for all the EntityRepository with "activated=true".

      [org.apache.deltaspike.core.util.ClassDeactivationUtils] (MSC service thread 1-4) class: domain.repository.WfNamedQueryRefEntityRepository activated=true


      What else I am missing.