0 Replies Latest reply on Jun 13, 2015 3:25 AM by jiayuchen

    How to inject a EntityManager to BaseDao with CDI in wildfly 8.2?

    jiayuchen

      In my BaseDao , I use

      @PersistenceContext(unitName = "primary")
      protected EntityManager em;

      to inject an EntityManager and other daos inherit from it , for example ,UserDao. In my project,I use

      @Inject
      private UserDao userDao;

      sometimes, not everytime, it throws exception like

      Can not set javax.persistence.EntityManager field com.XXX.storage.dao.BaseDao.em to com.XXX.storage.dao.UserDao$Proxy$_$$_WeldSubclass ,I dont know the reason ,can anyone help me?Many thanks!