ManyToOne annotated members from child entities are null after initial merge/persist

Description

Having the following entities:

Parent having List<Child> as member, annotated as following:
@Valid
@OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, orphanRemoval = true)
@JoinColumn(name = "parentId")

Child having parent as member (handled as readonly, never assigned directly), annotated as following:
@ManyToOne
@JoinColumn(name = "parentId")

When creating a parent entity with a N Child entities, the first entityManager.merge(parent) will return a copy of the parent where all the children do not have the parent set.

Reloading the entity has no effect, only workaround is to clear the session.

Environment

None

Assignee

Unassigned

Reporter

sh@discovergy.com

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Feedback Requested

2019/01/23

Feedback Requested By

Gail Badner

Components

Affects versions

Priority

Major
Configure