Frage

Hier ist die abgestreifte Version meines Codes: generasacodicetagpre.

ist der obige Code erlaubt?Ich habe zwei eingebettete Klassenkosten und Artikellokation, die ich mit @ElementCollection verwende.

Ausgabe: Wenn ich versuche, eine benannte Abfrage auszuführen generasacodicetagpre.

Ich habe ein seltsames Verhalten.Die Datensätze in der zweiten Elementkollektion (Itemlccationstabelle) werden verdoppelt (in die Tabelle eingefügt).

War es hilfreich?

Lösung

What it comes to JPA 2.0, your code is allowed. It is perfectly legal to have more than one collections that are annotated with ElementCollection. Also, it most likely does not have anything to do with problem you have. By the way, to find out is that really your problem, had you tried your code without costs collection?

In which point exactly duplicates in this collection occur first time? If ItemLocation does not define equals&hashcode, duplicates can easily come as result of adding items by yourself.

Possibly you are facing this problem: Primary keys in CollectionTable and chancing type to list and adding @OrderColumn will help.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top