ObjectDB ObjectDB

c.o.jpa.type.EntityTypeImpl.getIdType() returns null



i currently try to use objectdb for a new project. i wanted to use it in combination with spring-data-jpa (M2), but i'm not able to use the automatic repository feature because the following code fails

    EntityType<T> type = metamodel.entity(domainClass);

    if (type == null) {
        throw new IllegalArgumentException(
            "The given domain class can not be found in the given Metamodel!");

    this.attribute = type.getId(type.getIdType().getJavaType());

in the debugger is i can see this member m_idType is null

type EntityTypeImpl<X>  (id=57)
m_attrMap LinkedHashMap<K,V>  (id=74)
m_declAttrMap LinkedHashMap<K,V>  (id=78)
m_entityName "Foo" (id=80)
m_errorManager JPE  (id=83)
m_idClassAttr Collections$EmptySet  (id=87)
m_idSingleAttr SingularAttributeImpl<X,T>  (id=96)
m_idType null
m_superType null
m_sysType Class<T> (package.Foo) (id=49)
m_versionAttr null

my entity looks like this

public class Foo implements Serializable {

    private static final long serialVersionUID = 6677607256121084732L;

    private Long id;

persistence.xml and spring context xml is pretty much the same as in the spring mvc jpa example.

i'm i doing something wrong or is it just some missing implementation in objectdb?


The JPA Metamodel API is fully supported by ObjectDB, but it seems that the getTypeId method was implemented only for ID classes and not for simple single field IDs.

Version 2.2.3_01 should fix this. Thank you for your report.


ObjectDB Support

thanks for you investigation,
i'm currently using the version 2.2.3 of the maven artifact and still have the same issue.

maybe this helps, the MetamodelImpl looks pretty empty to me

metamodel MetamodelImpl  (id=132)
m_embeddableTypeList null
m_entityTypeList null
m_errorManager JPE  (id=138)
m_managedTypeList null
m_sysTypeToType HMP  (id=142)
m_typeManager TYM  (id=144)
m_typeUpdateCount -1

i stepped throw springs LocalContainerEntityManagerFactoryBean and everything looks fine, the persistence.xml file is parsed and objectdb set as provider.

i also added my entity class name in a <class> element of the persistence.xml, which didn't help

let me know if i should provide you with more code/xml or an sample project


You should use 2.2.3_01 (the fix was applied after the release of 2.2.3).

I just added it to the Maven repository (usually x.x.x_x builds are available for download only as zip distribution).

ObjectDB Support

sorry, i just checked the download page after my post.

i have deployed the 2.2.3_01 version to my mvn repo and this fixed the problem.

thank you very much for this very quick fix!


btw: would be nice to have those builds as a patch or snapshot version maven artifact in the future ;)


No problem and thanks again for your report.

You are right about the Maven repository. Build 2.2.3_01 was added now and it makes sense to keep the download page and the Maven repository synchronized in the future.

ObjectDB Support


To post on this website please sign in.