简体   繁体   中英

TopLink - Where are the JPA classes

Does Oracle TopLink not include the JPA classes?

I am trying to create a JPA/TopLink project. I have downloaded the latest version of the TopLink jar (12c 12.1.2) and made sure to include it in the classpath.

The problem is that I cannot seem to find any of the javax.persistence.* classes like Entity, Column etc. I though that all implementations of JPA such as TopLink, Hibernate etc would include those classes. Is that not true? How else should I get this JPA/Toplink project to work?

According to this article, Toplink 12.1.2 is built off of EclipseLink and supplies extra goodies such as support for RESTful services, meaning the javax.persistence.* packages are contained within the eclipselink.jar file. This file should exist within the jlib folder of the toplink.zip download.

You can find your javax.* classes in the jars supplied with any Java EE compliant server (you can find the jar somewhere in the lib folder usually). If you use maven:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
</dependency>

Or download the jar directly (version 7):

http://mvnrepository.com/artifact/javax/javaee-api/7.0

Put it on your relevant classpath and everything should work (im not sure about toplink, you might need version 6 of API - which can be also found in maven repositories).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM