osgi / osgi

OSGi Specification Project Build Repository. Specification, API, implementation, and TCK source code.
https://docs.osgi.org/
Apache License 2.0
104 stars 40 forks source link

[jpa][tck] org.osgi.test.cases.jpa.junit.JPAService_1_1_TestCase.testUseStandardDataSourceConfig() relies on unspecified behaviour #735

Open laeubi opened 4 months ago

laeubi commented 4 months ago

org.osgi.test.cases.jpa.junit.JPAService_1_1_TestCase.testUseStandardDataSourceConfig() says it is testing JPA Service Spec 127.3.4.1 of the spec that says where it reads:

The EntityManagerFactoryBuilder service must support the defined property names as per the JPA specification. In most cases this will be accomplished by passing the values directly to the Persistence Provider, but in some cases it may require further action from the JPA Service implementation.

Here it seems it relies on the fact that it can pass an preconstructed DataSourceFactory in the properties with javax.persistence.dataSource. This seems to be a specific behavior implemented in Aries JPA but I can't find this documented or required anywhere in the JAP nor the OSGi-JPA spec.

laeubi commented 4 months ago

It seems EclipseLink supports a property named javax.persistence.nonJtaDataSource even though I can't find a real documentation for this behaviour.

timothyjward commented 4 months ago

OpenJPA also has properties for this - https://github.com/apache/openjpa/blob/b3d1ef8671751d47617eaf4ac259b43eae45e53b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java#L50-L52

It has always appeared to be a poorly documented spec feature which is implemented by everyone.

laeubi commented 4 months ago

At least EclipseLink refuses to use javax.persistence.dataSource :-( I have now added a workaround here, but maybe one should enhance the Spec simply by claiming an implementation should support this? Ist otherwise also hard to discover by users of the specification.

stbischof commented 2 months ago

@maho7791 any opinion on that?