1

Generally I will use the following framework in my project: Spring MVC + Hibernate with Tomcat as the container.

And I never care about the version, the later the better.

This is the concrete SDK, framework version in the project:

JDK 1.7
Spring Framework:
    spring-webmvc >> 4.1.6.RELEASE
Hibernate:
    hibernate-entitymanager >> 4.3.10.Final
        org.hibernate.javax.persistence >> hibernate-jpa-2.1-api >> 1.0.0.Final
Tomcat 7

The application works well under tomcat, however I meet some problems when I deploy the application from Tomcat to a Java EE Server(which support JavaEE 5 only).

One of the error I got is something like:

java.lang.NoSuchMethodError: javax.persistence.Table.indexes()

It seems that the indexes is a new method in JPA2.1(which is supported in JavaEE 7) while the Java EE server does not provide it.

But as shown, the hibernate dependency org.hibernate.javax.persistence >> hibernate-jpa-2.1-api >> 1.0.0.Final provide the methods, why the Java EE Server can not use that?

And to solve the problme, for a given JavaEE Server say it support JavaEE 5 only, what should be under consideration when choosing JDK, frameworks?

hguser
  • 35,079
  • 54
  • 159
  • 293

1 Answers1

1

JPA 2.1 is for JavaEE7 and Java 7 onwards.

For JavaEE compatibity with JDK versions, I would take a look at this previous StackOverflow question.

Community
  • 1
  • 1
Luke Bajada
  • 1,737
  • 14
  • 17
  • Java EE 7 is specified to be compatible with Java 7, and by extension therefore, JPA 2.1 as well. – Steve C Jun 20 '15 at 06:50