RE: [eclipselink-dev] javax.persistence in eclipselink.jar
JPA 2.0 classes added to eclipselink.jar are done so intentionally to allow
this library to be used with the JPA 1.0 API as a 1.0 provider. Within the
implementation classes there are some hard dependencies on these new JPA 2.0
classes. The ones we include are those classes not in JPA 1.0 that are required
by our implementation.
example of the issue is with EntityManager in JPA 2.0 having a dependency on
CriteriaBuilder and TypedQuery. Our EclipseLink 2.0 implementation of this
interface, EntityManagerImpl, must implement methods like:
TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery);
means that the class-loader loading EntityManagerImpl must be able to resolve
its dependencies on TypedQuery and CriteriaBuilder. When running with the JPA
1.0 API library these classes do not exist. We have added them to
eclipselink.jar to address this issue.
intent is that in a JPA 2.0 container the full API is available and hopefully
loaded ahead of the eclipselink.jar and thus these duplicate classes will never
are only running with JPA 2.0 you can either use the bundles produced from the
project or you can build a custom version of the eclipselink.jar that does not
have these classes.
I am puzzled by the fact that in trunk eclipselink.jar contains *some
selected* classes from javax.persistence. Actually, I don’t see why
eclipselink.jar should contain classes from javax.persistence at all. But if
it contains these classes, it should contain the entire API, I think. Moreover
the selection is not complete as it for example does not contain
javax.persistence.Query, which has been changed in 2.0.
In the trunk/build.xml, I find the comment
<!-- JPA 1.1/2.0 concurrent dev solution: New classes from
javax.persistence 2.0 -->
So, likely, this is just some leftover from 1.2.
(I am currently testing on JBoss where I am seeing a mixed 1.0/2.0 API
which causes some confusion) ;-)