I have a many to many relationship bewteen Release and Project. The Release entity expresses that relationship like this;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "release")
private List<ProjectRelease> releaseProjects;
Inside a @Transactional method a new Release is created along with its associated projects.
During that transaction execution and after I've called the save method on the ReleaseRepository and ProjectReleaseRepository, I make a call to release.getReleaseProjects() which returns null.
However, If I make a call to projectReleaseRepository.findByReleaseCode(release.code), this would return the acual list of projects that have been associated to the release during the present transaction.
What's causing the release.getReleaseProjects() list to be null during the transaction execution? What's the right way to go here?