ObjectDB ObjectDB

Spring 4 setup


Can someone provide an example of setup ObjectDB embeded to be used with Spring4?

Existing examples is like for Spring3 and I can't figure how to use ObjecDB in Spring tutorial:





This tutorial uses Spring Boot and Spring JPA Data, so hidden default configuration applies (using Hibernate with the H2 database).

To use the tutorial with ObjectDB you will have to add the following:

In the pom.xml file under dependencies:


In the pom.xml file under repositories:

           <name>ObjectDB Repository</name>

In the Application class:

    JpaVendorAdapter JpaVendorAdapter() {
        return new AbstractJpaVendorAdapter() {
            public PersistenceProvider getPersistenceProvider() {
                return new com.objectdb.jpa.Provider();
            public Map<String,?> getJpaPropertyMap() {
                return Collections.singletonMap(
                    "javax.persistence.jdbc.url", "test.odb");
ObjectDB Support

I am using Spring Boot too. I have 2 questions for the answer.

1. I have to add h2 dependency to my pom file, otherwise I will get some exception like:

'Cannot determine embedded database driver class for database type NONE'


2. The entity object can not extend org.springframework.data.jpa.domain.AbstractPersistable<Long>, otherwise I will get below error. I think the error is caused by generic extending.

Caused by: com.objectdb.o.UserException: Unsupported auto value type java.io.Serializable for field org.springframework.data.jpa.domain.AbstractPersistable.id
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.MDF.T(MDF.java:640)
at com.objectdb.o.ANM.ac(ANM.java:761)
at com.objectdb.o.ANT.W(ANT.java:982)
at com.objectdb.o.ANT.V(ANT.java:879)
at com.objectdb.o.SCM.r(SCM.java:305)
at com.objectdb.o.SCM.r(SCM.java:208)
at com.objectdb.o.SCM.r(SCM.java:208)
at com.objectdb.o.TYS.n(TYS.java:294)
at com.objectdb.o.TYM.ae(TYM.java:521)
at com.objectdb.o.TYM.ac(TYM.java:467)
at com.objectdb.o.TYM.ao(TYM.java:788)
at com.objectdb.jpa.MetamodelImpl.obtainType(MetamodelImpl.java:269)
at com.objectdb.jpa.MetamodelImpl.managedType(MetamodelImpl.java:149)
... 53 more

Do you have a demo code on the Github to let use fully understand how should we use ObjectDB with latest version of Spring Boot?


It is unclear why you need to specify h2. I think that in the tutorial of #1 with the adjustment of #2 it was not necessary. Assuming you do not use h2, maybe your application uses some default setting of Spring Framework that uses Hibernate + H2.

Regarding your second question, it is indeed unrelated to this thread, so good that you moved it to a new forum thread.

Note: See an update on this forum thread.

ObjectDB Support


To post on this website please sign in.