I installed GlassFish 5
and GlassFish Tools
(from http://download.eclipse.org/glassfish-tools/1.0.0/repository/). I also tried with GlassFish 4.1.1, results were the same.
I created a new JPA Project (JPA 2.1):
In Data Source Explorer View of Eclipse, I added and tested a Database Connection:
- Connection Profile: Derby
- "Derby Embedded JDBC Driver 10.2" with driver file
~/glassfish5/javadb/lib/derby.jar
Next, I added an entity file MD.java
. The boilerplate code gives me an error:
The import javax.persistence can not be resolved.
I wanted to get rid of this error, but "Search repositories for javax.persistence" does not yield any search result.
First question: How to fix this in Eclipse? If it was a Maven Project (not JPA project), I think I would have added to pom.xml:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
Second question: In "Project Facets" of project properties (and upon creation of "JPA Project"), I am able to select only JPA versions less or equal 2.1
. How can I use JPA 2.2
in an Eclipse JPA Project?
As you might have guessed by now, I am quite new to Eclipse...