OneToMany löscht Eintrag aus Collection

OnDemand

Top Contributor
Hallo zusammen,

habe folgendes Problem:

Eine Entity "Product" hat eine Collection List<ProductsPropertiesCombinations>:
Code:
@OneToMany(orphanRemoval = true, cascade = {CascadeType.ALL})
@JoinColumn(name = "product_id")
@LazyCollection(LazyCollectionOption.FALSE)
private List<ProductsPropertiesCombinations> productsPropertiesCombinations = new ArrayList<ProductsPropertiesCombinations>();


ProductsPropertiesCombinations hat wiederum eine List mit List<ProductsPrice>
Code:
@OneToMany(orphanRemoval = true, cascade = {CascadeType.ALL})
@LazyCollection(LazyCollectionOption.FALSE)
@JoinColumn(name = "products_properties_combi_id")
private List<ProductsPrice> productsPropertiesPrices = new ArrayList<>();

//Getter und Setter

Zur Laufzeit passiert folgendes:

Die Collection List<ProductCombination> bekommt 2 ProductCombination mit jeweils einer Collection ProductPrice.

Nun kommt irgendwann ein 3. ProductCombination dazu und wird abgespeichert, dabei verliert das 2. ProductCombination seine ProductPrice Collection.

Kann mir das nicht erklären, woher das kommt. Der Hibernate Log updated da was weg. Hat jemand ne Idee, in welche Richtung ich suchen muss?

Edit: Während ich debugge, prüfe ich genau vor dem speichern: Alle 3 Childs haben je eine Collection mit einem Preis. Das sieht so aus, wie es soll.
 

Ähnliche Java Themen

Neue Themen


Oben