Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure STS with JPA 2.0 using PostgreSQL 9.3

I have an old Spring MVC project which I used to run with Eclipse on JBoss and using JPA 2.0 with (I believe) a PostgreSQL 9.1 DB. Also using Maven as dependencies resolver.

I managed to get the project back from an HDD crash but I couldn't get it to run properly using Eclipse/Tomcat so I thought I might use the opportunity to start using STS (Spring Tool Suite) and get a clean project and just re-insert the code where it belongs.

Sadly, I'm stuck at the very beginning... I created a Spring MVC project with Maven support, but can't set up the JPA 2.0 part.

I went to Project > Properties > Project Facets, checked JPA and clicked on the freshly appeared link "Further configuration required...".

This brought me to the JPA Facet configuration panel where I can choose from two platforms "Generic 2.1" and "EclipseLink 2.5.x". I could only find some noSQL and Oracle support for EclipseLink so I thought I would go for Generic 2.1 (does that mean it's JPA 2.1 ?).

Now I can choose a JPA implementation "User Library" or "Disable Library Configuration". I tried importing the .jar defined by this maven dependency:

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

But it just tells me "The class 'javax.persistence.Convert' is required to be in the selected libraries".

Maybe Hibernate's version of JPA isn't "Generic 2.1" compliant ? I've seen a few times "you need to download Hibernate tools" but that didn't change anything.

Also, when I try to create a connection using PostgreSQL, I don't have any driver to choose from and if I want to add one, the only one I'm allowed to add is a jdbc-postgres-8.x driver.

like image 345
Michael De Keyser Avatar asked Jun 24 '14 20:06

Michael De Keyser


Video Answer


1 Answers

After clicking the "Further configuration required..." link, click the download icon to the right of the (probably empty) list. That will give you a set of libraries that you can select and download and then choose from afterwards, such as an EclipseLink library. See the screenshot

Screenshot of library download dialog

like image 197
djb Avatar answered Sep 28 '22 18:09

djb