Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

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

On the contrary everything is fine and no errors occur when I am executing the program on Wildfly which uses Hibernate.

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:

@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. Do I need any additional annotation?

like image 957
ammerzon Avatar asked Oct 13 '15 13:10

ammerzon


1 Answers

You will get this error if you use a field named "type".

like image 94
Alex Wade Avatar answered Sep 30 '22 01:09

Alex Wade