Search code examples
jpaapache-tomee

What is the PersistenceProvider class for TomEE 9.0?


I am creating a new application for TomEE 9.0. I have a simple JPA application that needs to connect to the database. I get the following error:

Nov 17, 2021 10:51:22 AM jakarta.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver log
WARNING: jakarta.persistence.spi::No valid providers found.

What must the provider in the persistence.xml be for TomEE 9.0-targeted projects?


Solution

  • As stated in a comment, you want to use EclipseLink as JPA Provider. The required provider class can be found in the documentation of Eclipse Link 3.0 and is

    org.eclipse.persistence.jpa.PersistenceProvider
    

    Therefore, you need to add the related dependency:

    <!-- https://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink -->
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>eclipselink</artifactId>
        <version>3.0.2</version>
    </dependency>
    

    In addition, you need to specific the JPA provider class via in your persistence.xml:

    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>