Martin, et al. With regard to the "which OSGi spec version...", do the OSGi specs in any way mandate which JPA spec is used? If so, we definitely want to target 2.0 (although this will go into the Hibernate codebase supporting JPA 2.1).
In general, we should follow OSGI Spec 4.2 (its the most common spec for all frameworks).
For the supported JPA-Spec, I have looked in the specs and found the following (in all OSGI Specs from 4.2 to 5.0):
127.1.3 Dependencies
This specification is based on JPA 1.0 and JPA 2.0. JPA 2.0 is backward compatible with JPA 1.0. For
this reason, the versions of the packages follow the OSGi recommended version policy with the addi-
tion of a special JPA marker that annotates the specification version for JPA. All JPA Packages must
also have an attribute called jpa that specifies the JPA version. The purpose of this attribute is to
make it clear what JPA version belongs to this package.
Table 127.1 - Dependency versions
JPA
Packages
Export Version
Client Import Range
Provider Imp. Range
JPA 1.0
javax.persistence
1.0
[1.0,2.0)
[1.0,1.1)
javax.persistence.spi
1.0
[1.0,2.0)
[1.0,1.1)
JPA 2.0
javax.persistence
1.1
[1.1,2.0)
[1.1,1.2)
javax.persistence.spi
1.1
[1.1,2.0)
[1.1,1.2)
For example, JPA should have an export declaration like:
Export-Package: javax.persistence; version=1.1; jpa=2.0, ...
Two ways:
Stay at JPA 2.0
or use JPA 2.1 with
Export-Package: javax.persistence; version=1.2; jpa=2.1, ...
or something similar.
The second approach needs to be checked if it is valid - but according the OSGI specs, it should be allowed.
Please correct me, but JPA 2.1 is backward compatible with JPA 2.0. If yes then the above Export-Package statement would be ok, and we could use jpa=2.1 to show that JPA Spec 2.1 is supported.
In general, we should follow OSGI Spec 4.2 (its the most common spec for all frameworks).
For the supported JPA-Spec, I have looked in the specs and found the following (in all OSGI Specs from 4.2 to 5.0):
127.1.3 Dependencies
This specification is based on JPA 1.0 and JPA 2.0. JPA 2.0 is backward compatible with JPA 1.0. For
this reason, the versions of the packages follow the OSGi recommended version policy with the addi-
tion of a special JPA marker that annotates the specification version for JPA. All JPA Packages must
also have an attribute called jpa that specifies the JPA version. The purpose of this attribute is to
make it clear what JPA version belongs to this package.
Table 127.1 - Dependency versions
For example, JPA should have an export declaration like:
Export-Package: javax.persistence; version=1.1; jpa=2.0, ...
Two ways:
Export-Package: javax.persistence; version=1.2; jpa=2.1, ...
or something similar.
The second approach needs to be checked if it is valid - but according the OSGI specs, it should be allowed.
Please correct me, but JPA 2.1 is backward compatible with JPA 2.0. If yes then the above Export-Package statement would be ok, and we could use jpa=2.1 to show that JPA Spec 2.1 is supported.