Skip to content

Is there any pitfall using mutable set when mapping two repositories by using @OneToMany

I have two repositories mapped by using @OneToMany notation. Let’s say @OneToMany entity is A, and @ManyToOne entity is B. I keep mutableSetOf(B) in entity of A. After I map two of them I had to get first B after checking some properties. But while debugging I realized that order of them comes randomly at each time. I could not find this issue online. Is this thing I am having possible?



Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

User contributions licensed under: CC BY-SA
8 People found this is helpful