Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate JPA错误:应为IdClass映射_Hibernate_Jpa_Wildfly - Fatal编程技术网

Hibernate JPA错误:应为IdClass映射

Hibernate JPA错误:应为IdClass映射,hibernate,jpa,wildfly,Hibernate,Jpa,Wildfly,我有一个@MappedSuperclass VoBusinessObject,其中包含id和版本 ` ` 所有实体都扩展VoBusinessObject,因此它们继承id和版本 当我将我的应用程序部署到wildfly 8.2时,我得到 Caused by: java.lang.IllegalArgumentException: expecting IdClass mapping at org.hibernate.jpa.internal.metamodel.AttributeFactor

我有一个@MappedSuperclass VoBusinessObject,其中包含id和版本

`

`

所有实体都扩展VoBusinessObject,因此它们继承id和版本

当我将我的应用程序部署到wildfly 8.2时,我得到

Caused by: java.lang.IllegalArgumentException: expecting IdClass mapping
    at org.hibernate.jpa.internal.metamodel.AttributeFactory$3.resolveMember(AttributeFactory.java:979) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.metamodel.AttributeFactory$4.resolveMember(AttributeFactory.java:1018) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:466) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:93) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.metamodel.MetadataContext.wrapUp(MetadataContext.java:256) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:96) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:148) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:867) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]

Caused by: org.hibernate.AnnotationException: Unable to define @Version on an embedded class: de.itwiesner.hannymede.common.valueobjects.VoBusinessObject
    at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1734) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2632) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.bindIdClass(AnnotationBinder.java:2719) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.mapAsIdClass(AnnotationBinder.java:1041) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:781) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
映射我的继承的正确方法是什么

致意


Heiko

问题是子类中的@ID。 恼人的是,Hibernate没有告诉实体它发生在哪里

致意


Heiko

您是否将
@Id
映射添加到
VoBusinessObject
的任何子类?您好,布莱恩,我看过这篇文章,但我没有复合键。
@IdClass(VoBusinessObject.class)
Caused by: org.hibernate.AnnotationException: Unable to define @Version on an embedded class: de.itwiesner.hannymede.common.valueobjects.VoBusinessObject
    at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1734) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2632) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.bindIdClass(AnnotationBinder.java:2719) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.mapAsIdClass(AnnotationBinder.java:1041) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:781) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]