0

I have some JPA module which includes entities using @Index and some code using EntityManagerFactory etc. that is currently depending directly on OpenJPA. What is a good way to make it independent of the JPA implementation without limiting it to Java 7?

Basically, I'm looking for some implementation-neutral JPA 2.1 spec jar. Is there such a thing? If my intent makes no sense, please tell me why.

user1050755
  • 11,218
  • 4
  • 45
  • 56
  • Index and EntityManagerFactory are standard JPA classes, not proprietary OpenJPA classes. So your code using these classes is already independent of OpenJPA. What's the problem? – JB Nizet Apr 07 '14 at 19:55
  • It is accessing @Index in openjpa dependencies. I can fix that, but fixing that requires introducing incompatibility with Java 5 and 6. I need a non-core library that provides the JPA 2.1 api implementation-independently. – user1050755 Apr 07 '14 at 20:05
  • 1
    You mean that the problem is that you want a jar file, not provided by OpenJPA, and which contains the JPA API classes? If so, here it is: http://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final – JB Nizet Apr 07 '14 at 20:13

1 Answers1

0

I downloaded Oracle's official Java EE 7 SDK distribution and recognized that it contains Glassfish. From http://mvnrepository.com/artifact/javax/javaee-web-api/7.0 I deduce (it reports GLASSFISH as issue tracker) that the official api likely is best represented by:

<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>javax.persistence</artifactId>
    <version>2.1.0</version>
</dependency>
user1050755
  • 11,218
  • 4
  • 45
  • 56