Connect to objectdb database

#1

I am experiencing a problem with connecting to existing database using IntelliJ and Spring Boot Jakarta. My persistance.xml file looks like this:

 xmlns="https://jakarta.ee/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
             version="3.0">

     name="objectdb-unit">
        >com.objectdb.jpa.Provider>
        >
             name="jakarta.persistence.jdbc.url" value="objectdb://11.13.0.151/my_database.odb"/>
             name="jakarta.persistence.jdbc.user" value="admin"/>
             name="jakarta.persistence.jdbc.password" value="admin"/>
        >
    >
>

And I'm getting this error when creating EntityManagerFactory 

EntityManagerFactory emf = Persistence.createEntityManagerFactory("objectdb-unit");

ERROR:

2024-08-06T16:24:35.586+02:00 ERROR 18200 --- [nio-8080-exec-1] c.v.flow.server.DefaultErrorHandler      : 

jakarta.persistence.PersistenceException: No Persistence provider for EntityManager named objectdb-unit

Can someone help with connection to database. Thanks

#2

This error may indicate that the persistence.xml file is not found by JPA/ObjectDB in the expected path in the classpath.

Note that defining a persistence context is not mandatory when using ObjectDB. You can also try:

EntityManagerFactory emf = Persistence.createEntityManagerFactory(
    "objectdb://11.13.0.151/my_database.odb");

See the  persistence unit manual page for more details.

ObjectDB Support
#3

Looking at the error again, it seems that you use the wrong JPA version. Currently ObjectDB uses the JPA 2.2 JAR file and you use Jakarta, which is not supported yet by ObjectDB.

ObjectDB Support

Reply