Specified field type [interface javax.persistence.EntityManager] is incompatible with resource type [javax.persistence.EntityMan

java.lang.IllegalStateException: Specified field type [interface javax.persistence.EntityManager] is incompatible with resource type [javax.persistence.EntityManagerFactory]

 

出现的问题。

 

错误原因

 

在一个Service类中

@PersistenceUnit EntityManager em;

 

应该改为

 

@PersistenceContext EntityManager em;

 

 

你可能感兴趣的:(service,interface)