views:

1292

answers:

3
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

I've created a JPA project where I try to user the above classes but I'm unable to find what jar I'm missing for them. Please guide me.

+1  A: 

Try the Geronimo specs JPA2 jar http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/geronimo/specs/geronimo-jpa_2.0_spec/1.0-PFD2/ There is still no official JPA2.jar

DataNucleus
What's wrong with the one of the RI (EclipseLink 2.0) which has been released in the same time as Java EE 6?
Pascal Thivent
Who said anything is "wrong" with some companies own provided jar to include javax.persistence classes? Theirs presumably is up to PFD2 level of the spec. The fact is that there is currently no "official" jpa2.jar ... stored in Maven2 repos under "javax/persistence/persistence-api/2.0", hence using the Geronimo specs jar (or some other that people can find) is the way to go until SUN/Oracle finally provide one. The ones under EclipseLink are "EclipseLink version of javax.persistence" only
DataNucleus
But what makes the case of Geronimo jar different? Why should I prefer this jar over the one from the RI?
Pascal Thivent
I said "try the Geronimo specs jar", since that provides an Apache 2 licensed spec jar to use, and it gets the user beyond his problem. It's license is the most liberal around. It's also the only one in the main Maven2 repo IIRC. What is an "RI" ? its simply a proof of concept that the spec is implementable; comes with no magic blessing or anything. Use what you wish at the end of the day
DataNucleus
+3  A: 

EclipseLink provides the JPA 2.0 Reference Implementation which is officially out since Java EE 6 is out. You'll find these classes in the jars bundled in eclipselink-2.0.0.v20091127-r5931.zip. If you are looking for a Maven repo, have a look at this page.

Pascal Thivent