public enum Genre {
DRAMA, HORROR, MYSTERY, THRILLER
}
@Entity
public class Book {
@Id
Long id;
String title;
@ManyToOne
Author author;
@Enumerated(EnumType.STRING)
Genre genre;
}
And loading my application context in a test, I get the following stacktrace:
...
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.crygier.graphql.GraphQLExecutor]: Factory method 'graphQLExecutor' threw exception; nested exception is java.lang.UnsupportedOperationException: Attribute could not be mapped to GraphQL: org.hibernate.jpa.internal.metamodel.SingularAttributeImpl@54ae1240
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
... 42 common frames omitted
Caused by: java.lang.UnsupportedOperationException: Attribute could not be mapped to GraphQL: org.hibernate.jpa.internal.metamodel.SingularAttributeImpl@54ae1240
at org.crygier.graphql.GraphQLSchemaBuilder.getAttributeType(GraphQLSchemaBuilder.java:151) ~[classes/:na]
at org.crygier.graphql.GraphQLSchemaBuilder.getObjectField(GraphQLSchemaBuilder.java:96) ~[classes/:na]
...
Trace debugging reveals that the expection is raised for Book.genre. How can the model generation be updated to allow for such a mapped enum field?
As seen in: https://github.com/timtebeek/graphql-jpa-enum When using the following:
And loading my application context in a test, I get the following stacktrace:
Trace debugging reveals that the expection is raised for
Book.genre
. How can the model generation be updated to allow for such a mapped enum field?