You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by "Nerriere, Christian" <Ch...@Eaton.com> on 2018/08/24 08:02:21 UTC

Aries 2.7.0 -> JPA 2.0 or 2.1?

Hello,

I'm using Karaf 4.2 with Aries 2.7.0 and Hibernate 5.2.9.Final and when I run a persistence test (without pax-exam), I've the following error:

...
java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
...

With the help of StackOverflow, I've understood that there was a dependency conflict between two libs defining the JPA spec 2.0 and 2.1. When running the test the maven dependencies are used to build the test classpath and it contains:

*         org\apache\aries\jpa\javax\persistence\javax.persistence_2.0\2.7.0

*         org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final

My question is: why does the Aries JPA container POM contain a dependency to JPA 2.0 (http://central.maven.org/maven2/org/apache/aries/jpa/org.apache.aries.jpa.container/2.7.0/org.apache.aries.jpa.container-2.7.0.pom) while the Aries feature definition contains a reference to JPA 2.1 (http://central.maven.org/maven2/org/apache/aries/jpa/jpa-features/2.7.0/jpa-features-2.7.0-features.xml)?

Thanks.

Christian N.




________________________________
Eaton Industries (France) S.A.S ~ Si?ge social: 110 Rue Blaise Pascal, Immeuble Le Vis?o - B?timent A Innovall?e, 38330, Montbonnot-St.-Martin, France ~ Lieu d'enregistrement au registre du commerce: Grenoble ~ Num?ro d'enregistrement: 509 653 176 ~ Capital social souscrit et liber?:EUR 16215441 ~ Num?ro de TVA: FR47509653176

________________________________



Re: Aries 2.7.0 -> JPA 2.0 or 2.1?

Posted by Timothy Ward <ti...@apache.org>.
The Aries JPA container is a flexible implementation designed to be used with a variety of JPA providers. It is tested across numerous versions of EclipseLink, Hibernate and OpenJPA. Some of these versions only support JPA 2.0 (OpenJPA only got JPA 2.1 support in June), as a result it can work with JPA 2.0 or JPA 2.1.

Aries JPA correctly sets up its import ranges so that this can work without problems, however this also relies on the persistence provider (in this case Hibernate) to set up its import ranges appropriately as well. If they haven’t got it quite right then they can end up being allowed to wire to JPA 2.0 even though that’s not what they should be using.

As Karaf wants to use JPA 2.1 then the sensible thing to do here is to have a Karaf feature which exclude the JPA 2.0 API and only exposes JPA 2.1, which is what they do.

I hope that this clears things up.

Tim

On 24 Aug 2018, at 09:02, Nerriere, Christian <Ch...@Eaton.com>> wrote:


Hello,

I’m using Karaf 4.2 with Aries 2.7.0 and Hibernate 5.2.9.Final and when I run a persistence test (without pax-exam), I’ve the following error:

…
java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
…

With the help of StackOverflow, I’ve understood that there was a dependency conflict between two libs defining the JPA spec 2.0 and 2.1. When running the test the maven dependencies are used to build the test classpath and it contains:
•         org\apache\aries\jpa\javax\persistence\javax.persistence_2.0\2.7.0
•         org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final

My question is: why does the Aries JPA container POM contain a dependency to JPA 2.0 (http://central.maven.org/maven2/org/apache/aries/jpa/org.apache.aries.jpa.container/2.7.0/org.apache.aries.jpa.container-2.7.0.pom) while the Aries feature definition contains a reference to JPA 2.1 (http://central.maven.org/maven2/org/apache/aries/jpa/jpa-features/2.7.0/jpa-features-2.7.0-features.xml)?

Thanks.

Christian N.




________________________________
Eaton Industries (France) S.A.S ~ Siège social: 110 Rue Blaise Pascal, Immeuble Le Viséo - Bâtiment A Innovallée, 38330, Montbonnot-St.-Martin, France ~ Lieu d'enregistrement au registre du commerce: Grenoble ~ Numéro d'enregistrement: 509 653 176 ~ Capital social souscrit et liberé:€ 16215441 ~ Numéro de TVA: FR47509653176