388 words

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

#1
2011-04-29 05:55

hi,

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

@Entity
public class Foo implements Serializable {
 
    private static final long serialVersionUID = 6677607256121084732L;
 
    @Id
    @GeneratedValue
    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?

chris
chris's picture
Joined on 2011-04-29
User Post #1
#2
2011-04-29 11:49

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #222
#3
2011-04-29 13:20

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

chris
chris's picture
Joined on 2011-04-29
User Post #2
#4
2011-04-29 13:32

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #223
#5
2011-04-29 13:38

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 ;)

chris
chris's picture
Joined on 2011-04-29
User Post #3
#6
2011-04-29 13:43

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #224

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.
Attachments:
Maximum file size: 32 MB
Cancel