Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE on initialization #269

Open
tomuszom opened this issue May 23, 2020 · 1 comment
Open

NPE on initialization #269

tomuszom opened this issue May 23, 2020 · 1 comment

Comments

@tomuszom
Copy link

@Table(name="A")
@Entity
public class A
        implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "a_id", nullable = false)
    private String aId;
}

@Table(name = "B")
@Entity
public class B
        implements Serializable {
    private static final long serialVersionUID = 1L;

    @EmbeddedId
    private B_ID id;

}

@Embeddable
public class B_ID
        implements Serializable {
    private static final long serialVersionUID = 1L;

    @ManyToOne
    @JoinColumn(name = "a_id", referencedColumnName = "a_id")
    @NotFound(action = NotFoundAction.EXCEPTION)
    private A a;

}

On calling GraphQLJpaSchemaBuilder.getObjectField(Attribute attribute, EntityType baseEntity)
getting baseEntity = null (from
private GraphQLFieldDefinition getObjectField(Attribute attribute) {
return getObjectField(attribute, null);
}
)

attribute = unknown#a(MANY_TO_ONE)

it leads to NPE

Caused by: java.lang.NullPointerException: null
at com.introproventures.graphql.jpa.query.schema.impl.GraphQLJpaSchemaBuilder.getObjectField(GraphQLJpaSchemaBuilder.java:908)
at com.introproventures.graphql.jpa.query.schema.impl.GraphQLJpaSchemaBuilder.getObjectField(GraphQLJpaSchemaBuilder.java:871)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at com.introproventures.graphql.jpa.query.schema.impl.GraphQLJpaSchemaBuilder.getEmbeddableType(GraphQLJpaSchemaBuilder.java:809)

@igdianov
Copy link
Collaborator

@tomuszom Thank you bug report! I will take a look at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants