Francesco Chicchiriccò opened SPR-16035 and commented

I am upgrading Apache Syncope (in its master branch) from Spring 4.3.11.RELEASE to Spring 5.0.0.RELEASE and I have just found that the classes:

  • OpenJpaVendorAdapter
  • OpenJpaDialect

are barely missing from spring-orm.

When I just copy these two classes' sources from 4.3.x into Syncope sources, everything works as expected.


Affects: 5.0 GA

Issue Links: - #18368 Remove Velocity support - #18997 Drop native OpenJPA support

Comment From: spring-projects-issues

Juergen Hoeller commented

I'm afraid we do not support OpenJPA anymore, at least not with such special adapter code. The reason is simply that OpenJPA is lagging far behind and hasn't even managed to release a JPA 2.1 compatible version yet. Since Spring Framework 5.0 requires JPA 2.1+, with dedicated support for JPA 2.2 already, OpenJPA is also not guaranteed to work at runtime either.

So from the perspective of Apache Syncope, you'd have to double-check whether OpenJPA actually works in a user project for you. It might work in your test setup where a separately provided JPA 2.1 API jar is present, but with a plain OpenJPA distribution, it's likely going to fail with Spring Framework 5.0 due to some JPA NoClassDefFoundError.

Comment From: spring-projects-issues

Francesco Chicchiriccò commented

Thanks for your answer.

The Apache OpenJPA PMC (which I am also member of) is currently committed to OpenJPA 3.0.0, which will be Java 8 and JPA 2.2 compliant. The current trunk code (available as 3.0.0-SNAPSHOT) is the one we are using in Apache Syncope 2.1.0-SNAPSHOT (master branch).

Comment From: spring-projects-issues

Francesco Chicchiriccò commented

FYI I have backported the missing classes in https://github.com/apache/syncope/commit/17a8eb5d99a84608a64927b00e7d9352d640517e - at least all of our unit and integration tests work fine with OpenJPA 3.0.0-SNAPSHOT and Spring 5.

Comment From: spring-projects-issues

Juergen Hoeller commented

Alright, thumbs up for finally making OpenJPA 3.0 happen! I don't see why it wouldn't work with Spring's general JPA support either once it's on JPA 2.1+, so your current solution seems totally ok there. Are you actually using any of the 'special' features in OpenJpaVendorAdapter? JDBC Connection retrieval maybe? Otherwise a standard Spring JPA setup would work just fine, which is why I'm asking.

What about shipping OpenJpaVendorAdapter with OpenJPA 3.0 itself? That way you would tightly align its release cycle and be able to adapt it to any OpenJPA API changes, and do integration tests against it... This wouldn't be unusual either since we have plenty of third-party frameworks shipping Spring adapters these days, e.g. Mybatis and Thymeleaf. Also, Spring's JpaVendorAdapter contract has been very stable for 10+ years now.

In general, we're trying to reduce third-party adapters in the core Spring distribution to two 'reference' implementations per case - validating our abstractions but not aiming for completeness there: e.g. Hibernate + EclipseLink for special JPA features, FreeMarker + Groovy for template rendering, etc. Note that we do not ship a DataNucleus adapter, and as mentioned no Thymeleaf adapter either (despite it being more popular than FreeMarker these days).

Comment From: spring-projects-issues

Francesco Chicchiriccò commented

FYI OpenJPA 3.0.0 was finally released: http://openjpa.apache.org/openjpa-3.0.x.html#OpenJPA-3.0.0

Comment From: powerbroker

well, there is: "The 4.x releases is an implementation of the Jakarta Persistence API 3.0 specification" available now.

and so what - still lagging far behind?

Comment From: bclozel

@powerbroker the latest OpenJPA source code seems to still contain integration tests for Spring. Can you elaborate what's missing?

Comment From: powerbroker

@powerbroker the latest OpenJPA source code seems to still contain integration tests for Spring. Can you elaborate what's missing?

well... i did like they describe here - https://gist.github.com/gdenning/1945181 included openjpa-all(4.0.0), spring-orm and spring-tx(both 6.1.11), configured bean of type 'org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter' in context and discovered it is not available(within 'org.springframework.orm.jpa.vendor' of spring-orm-6.1.11.jar)

gooooooogling around, found some thread about some "special" openjpa-3.2.2-jakarta.jar for Spring 6 - https://lists.apache.org/thread/zr4nbptd50kyxnfrj6tvcv3k75rymm90 and this issue report.