Entity cannot be resolved to a type
You will need to import javax.persistence.Entity
and javax.persistence.Id
. I believe their jar is also included in
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.2.Final</version>
</dependency>
Analysis
Please note that some of dependency definitions are out of the scope of the dependencies
element (see TODO:
):
<dependencies>
…
</dependencies>
<!-- TODO: Out-of-the-scope dependency definitions! -->
<!-- Hibernate-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<!-- MySQL Connector-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
…
Solution
Just move the out-of-the-scope dependency definitions into the dependencies
element.