Warm tip: This article is reproduced from stackoverflow.com, please click
eclipse mysql jakarta-ee

Cannot resolve type problems with eclipse

发布于 2020-03-27 10:30:43

It seems that I got the wires crossed & ask you to point me the right direction.

I have a problem with the Eclipse IDE for Enterprise Java Developers (version: 2019-06 (4.12.0), build id: 20190614-1200). There is a code part where I get the error message MysqlDataSource cannot be resolved to a type. Searching the Web, I found out that this class is included in the download of mysql-connector-java JAR 8.0.14 with all dependencies. I added it over the 'Fix project setup…', where I added the JAR file to the libraries of the Java Build Path. enter image description here Unfortunately, the error message does not vanish. Can you see what I am doing wrong?

Edit 1: With the hint from another Website, I found out that the hibernate JAR included was the source files JAR. So, I corrected it the hibernate-entitymanager JAR, clicked "Clean…" under "Project", but to no avail: the EntityManager is still unlocatable. (Well, after several tries, the first error message to resolve is no more with MySQL.) Try with the <code>hibernate-entitymanager</code> JAR

Questioner
Sae1962
Viewed
85
Sae1962 2019-07-05 22:38

As I learned from somebody on another Web site, the following lines have to be added to the pom.xml file:

<dependency>
    <groupId>org.hibernate.javax.persistence</groupId>
    <artifactId>hibernate-jpa-2.1-api</artifactId>
    <version>1.0.2.Final</version>
</dependency>

or

<dependency>
    <groupId>javax.persistence</groupId>
    <artifactId>javax.persistence-api</artifactId>
    <version>2.2</version>
</dependency>