291 words

Spring 4 setup

2014-09-20 10:26

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:




anthony's picture
Joined on 2014-09-20
User Post #1
2014-09-27 20:56

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support's picture
Joined on 2010-05-03
User Post #2,045
2014-10-24 13:15

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?

evil850209's picture
Joined on 2014-10-24
User Post #1
2014-10-25 22:53

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.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support's picture
Joined on 2010-05-03
User Post #2,076

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Maximum file size: 32 MB