The problem here was that the relationships I had defined weren't correct.
In User.java
:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
private List<AlertHistory> alertHistoryList = new ArrayList<>();
and in AlertHistory.java
:
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "user_id")
Once I got the relationship annotated and typed correctly, it started working as expected, so that if the User
has associated AlertHistory
's, they will populate, and if not, the collection will be empty. .isNotNull()
now works as expected.