我的应用程序在 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)
...
相反,当我在使用 Hibernate 的 Wildfly 上执行程序时,一切都很好,没有发生错误。
实体:
@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:
@POST
public Response create(Throw entity) {
em.persist(entity);
return Response.created(URI.create("...")).build();
}
我认为 Eclipselink 在解码我的 json 时有问题。我需要任何额外的注释吗?
最佳答案
如果您使用名为“type”的字段,您将收到此错误。
关于java - EclipseLink:类型的指示器字段值缺少类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33104232/