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

NullPointerException thrown when quering 4 th ManyToOne object #97

Open
recepp opened this issue Feb 22, 2023 · 0 comments
Open

NullPointerException thrown when quering 4 th ManyToOne object #97

recepp opened this issue Feb 22, 2023 · 0 comments

Comments

@recepp
Copy link

recepp commented Feb 22, 2023

I have 4 objects which associated with ManyToOne like shared below.

Exception thrown for this query.
query -> eventDeifiniton.eventA.eventB.eventC.name==test.
Exception -> java.lang.NullPointerException: Cannot invoke "com.querydsl.core.types.Path.getType()" because "path" is null

Exception fixed by adding QueryInit to EventDefinition.java.

@QueryInit("eventB.eventC")
private EventA eventA;

Do we have anothor way to fix this exception without @QueryInit?

--------------Objects----------------

`public class EventDefinition extends BaseEntity {

private String name;

@ManyToOne(fetch = FetchType.LAZY)
@JsonManagedReference
@JoinColumn(name = "event_a_id")
//@QueryInit("eventB.eventC")
private EventA eventA;

}`

`public class EventA extends BaseEntity {

@ManyToOne(fetch = FetchType.LAZY)
@JsonManagedReference
@JoinColumn(name = "event_b_id")
private EventB eventB;

private String name;

}`

`public class EventB extends BaseEntity {

@ManyToOne(fetch = FetchType.LAZY)
@JsonManagedReference
@JoinColumn(name = "event_c_id")
private EventC eventC;

private String name;

}`

public class EventC extends BaseEntity<UUID> { private String name; }

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

1 participant