Getting duplicated entities with @OneToMany and @ElementCollection

Description

Here's the demo:

In this demo, there are two entities: Root and Child.
One root can have many childs (@OneToMany).
A child can have many parameters (@ElementCollection).

First, the demo creates with success a root with one child which contains 3 parameters (a, b and c).
The issue comes when the previously created root is retrieved from the database because the child collection of the root contains n times the same child entity (n being the number of parameters in the child, 3 in the demo):

The expected behavior would be that the child collection of the root contains just one child entity like when it was inserted:

 

Environment

None

Status

Assignee

Unassigned

Reporter

Romain Moreau

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Feedback Requested

2019/11/11

Feedback Requested By

Gail Badner

Components

Priority

Major
Configure