调用EntityManager出现The import javax.persistence cannot be resolved

1.编写代码时无法导入import javax.persistence.EntityManager,刚开始还以为是自己的jdk1.7所以没有,百度后在StackOverFLow了解到需要jar包或者JPA API.像是JPA interfaces (Hibernate, EclipseLink, OPenJPA.)等.由于是用的maven所以直接导入对应的依赖就可以了

        <dependency>
            <groupId>org.eclipse.persistencegroupId>
            <artifactId>org.eclipse.persistence.jpaartifactId>
            <version>2.6.0version>
        dependency>

你可能感兴趣的:(调用EntityManager出现The import javax.persistence cannot be resolved)