简体   繁体   English

EclipseLink:缺少类型的指示符字段值

[英]EclipseLink: Missing class for indicator field value of typ

My application runs on Payara and provides a REST API but when I try to create an object with a POST request I get the following exception: 我的应用程序在Payara上运行并提供REST API但是当我尝试使用POST请求创建对象时,我得到以下异常:

Exception [EclipseLink-43] (Eclipse Persistence Services - 2.6.0.payara-p1): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Missing class for indicator field value [Miss] of type [class java.lang.String].
Descriptor: XMLDescriptor(at.htl.handballinheritance.entity.Throw --> [DatabaseTable(event), DatabaseTable(dataObject)])
  at org.eclipse.persistence.exceptions.DescriptorException.missingClassForIndicatorFieldValue(DescriptorException.java:940)
  at org.eclipse.persistence.internal.oxm.QNameInheritancePolicy.classFromRow(QNameInheritancePolicy.java:278)
  ...

Full Stacktrace 完整的Stacktrace

On the contrary everything is fine and no errors occur when I am executing the program on Wildfly which uses Hibernate. 相反,当我在使用Hibernate的Wildfly上执行程序时,一切都很好并且没有错误发生。

Entities: 实体:

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@XmlRootElement
public abstract class Event extends DataObject implements Serializable {
    ... 
}

@Entity
public class Throw extends Event implements Serializable {

    @Enumerated(EnumType.STRING)
    @NotNull
    private ThrowingType type;

    ...
}

public enum ThrowingType {
    Goal, Miss
}

REST API: REST API:

@POST
public Response create(Throw entity) {
    em.persist(entity);
    return Response.created(URI.create("...")).build();
}

I think that Eclipselink has problems to unmarshal my json. 我认为Eclipselink解决我的json问题。 Do I need any additional annotation? 我还需要任何其他注释吗?

如果使用名为“type”的字段,则会出现此错误。

Joined inheritance will by default use a 'type' field to determine the entity class to use, as does json/xml marshalling. 默认情况下,加入的继承将使用'type'字段来确定要使用的实体类,json / xml编组也是如此。 You have a type field, but populated it with "Miss' which can't be converted to a class. 您有一个类型字段,但填充了“Miss”,无法将其转换为类。

See eclipselink/Moxy : inheritance and attribute name oveloading based on type for custom strategies or https://www.eclipse.org/eclipselink/documentation/2.4/moxy/type_level003.htm if you can change the JSON being posted. 请参阅eclipselink / Moxy:继承和属性名称开发,基于自定义策略的类型https://www.eclipse.org/eclipselink/documentation/2.4/moxy/type_level003.htm,如果您可以更改发布的JSON。

The type field within JPA is somewhat discussed here http://www.coderanch.com/t/489497/ORM/databases/InheritanceType-JOINED-DiscriminatorColumn and here https://en.wikibooks.org/wiki/Java_Persistence/Inheritance#No_class_discriminator_column_2 JPA中的类型字段在这里有所讨论http://www.coderanch.com/t/489497/ORM/databases/InheritanceType-JOINED-DiscriminatorColumnhttps://en.wikibooks.org/wiki/Java_Persistence/Inheritance# No_class_discriminator_column_2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用EclipseLink JAXB(MOXy)解组XML时,DescriptorException“数据库行中缺少类指示符字段”异常 - DescriptorException “Missing class indicator field from database row” exception when unmarshalling XML using EclipseLink JAXB (MOXy) eclipselink在使用InheritanceType.TABLE_PER_CLASS时要求类指示符字段 - eclipselink asking for class indicator field when using InheritanceType.TABLE_PER_CLASS EclipseLink错误:异常描述:缺少类的描述符 - EclipseLink error: Exception Description: Missing descriptor for class Eclipse MOXy Unmarshall异常:数据库行中缺少类指示符字段 - Eclipse MOXy Unmarshall Exception: Missing class indicator field from database row EclipseLink ValidationException-非实体[class long]作为关系属性[field providerId]中的目标实体 - EclipseLink ValidationException - non-entity [class long] as target entity in the relationship attribute [field providerId] Eclipselink单个类高速缓存配置 - Eclipselink Individual Class Cache Configuration cglib 代理 class 中缺少字段注释 - Missing field annotation in cglib proxy class eclipselink在子类中忽略AdditionalCriteria - eclipselink AdditionalCriteria ignored in child class eclipselink条件在ReportQuery中的类类型上 - eclipselink condition on class type in ReportQuery 构建eclipselink-2.6.0失败,缺少要求 - Building eclipselink-2.6.0 fails with Missing requirement
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM