How to inject EmtityManager to BaseDao in wildfly8?

80 Views Asked by At

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!

0

There are 0 best solutions below