발생한 에러
org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance:
this.releaseOrganization =
req.getReleaseOrganizationId().size() == 0 ?
null :
(req.getReleaseOrganizationId().stream().map(
i -> releaseOrganizationRepository
.findById(i).orElseThrow
(CrEffectNotFoundException::new)
).collect(toList())) //입력으로 받아온 co effect 값
.stream().map(
//다대다 관계를 만드는 구간
ro -> new ReleaseOrgRelease(
ro,
this
)
).collect(toList());
this.releaseOrganization.clear();
Set<ReleaseOrgRelease> releaseOrganizations =
req.getReleaseOrganizationId().size() == 0 ?
null :
(req.getReleaseOrganizationId().stream().map(
i ->
releaseOrganizationRepository.findById(i)
.orElseThrow(ReleaseOrganizationNotFoundException::new)
).collect(toList())) //입력으로 받아온 co effect 값
.stream().map(
//다대다 관계를 만드는 구간
ro ->
new ReleaseOrgRelease(
ro,
this
)
).collect(Collectors.toSet());
this.releaseOrganization.addAll(releaseOrganizations);
https://blog.leocat.kr/notes/2016/04/26/hibernate-no-longer-reference