This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Looks like you're going to be using Hibernate with that ejb3-persistence.jar file of yours.
Gregg is correct, if you want to use JPA, you need a framework that supports it. Here's what you need to support a basic JPA & Hibernate development environment:
* A JDBC compliant Database. (and the ability to perform the most basic of database administration tasks.) * The JDK 1.5 or better, as annotations didn't exist before Java 5 * JDBC Drivers for your Database -that's how Hibernate connects to your database of choice * The various jar files and libraries associated with the Hibernate Core and Hibernate Annotations (essentially, you need Hibernate) * A properly configured hibernate.cfg.xml file on your runtime classpath.
My website has a free tutorial that goes through all of the steps required to set up a JPA and Hibernate environment.
ejb3-persistence.jar contains only one class (Persistence), four interfaces, several exceptions, and many annotations. It does not have much implementations, and is completely different from EJB2.x API. Sun has the copyright for the code in ejb3-persistence.jar. JBoss put it in this jar file.
I used Hibernate alone with hibernate3.jar (with some commons jars) before. It worked fine. We can say JPA is built on top of Hibernate (or Toplink, ...) and JPA API itself is not enough to create a DB access layer.
If your implementation is based on Hibernate EJB3 JPA, your code is not portable to other EJB3 JPA implementations (e.g., Toplink...) [ April 23, 2008: Message edited by: John King ]