Exception No Persistence provider for EntityManager named with Hibernate

28 Views Asked by At

I am using Eclipse, Derby and Hibernate and have set a project with a module descriptor as follows. enter image description here

This is my persistence.xml file

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" >
    <persistence-unit name="Todo_Hibernate" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>todo.Todo</class>
        <properties>
            <property name="jakarta.persistence.jdbc.url" value="jdbc:derby:D:\Eclipse_Java_21\Datenbanken\Hibernate_DB;create=true"/>
            <property name="jakarta.persistence.jdbc.user" value=""/>
            <property name="jakarta.persistence.jdbc.password" value=""/>
            <property name="jakarta.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create"/>
        </properties>
    </persistence-unit>
</persistence>

I am getting the following Warning and Exception

WARNUNG: jakarta.persistence.spi::No valid providers found. Exception in thread "main" jakarta.persistence.PersistenceException: No Persistence provider for EntityManager named Todo_Hibernate

I have defined the provider in the persistence.xml. Where else do I need to define the provider?

It works fine when not using a modularized project.

Thanks, Walter

0

There are 0 best solutions below