I would like to better understand the differences between
(1) a traditional Multivalued Relationship/Association
@Entity -> @OneToMany -> @Entity
and
(2) the JPA2 Collection of Embeddable (and basic) Types
@Entity -> @ElementCollection -> @Embeddable
I see the syntactical differences, but wonder whether there are also performance implications. Under the hood, the database implementation looks very similar.
Intuitively, I would typically use the @ElementCollection
for composition scenarios. But even that feels very similar like CascadeType=DELETE
.
Am I missing the essence here? Is one more efficient than the other for certain purposes?
Thank you, J.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…