Let C
be a class that has another class D
as its attribute. In principle, storing D
as an embedded class of C
must give better performance when retrieving than storing it as a separate entity through @ManyToOne
(or even @OneToOne
), since in the latter case, D
needs to be retrieved from a separate table possibly containing millions of rows.
My question is whether this performance difference is significant, i.e. is it big enough to offset other considerations when deciding between embedding and @ManyToOne
.
I realise this question is a bit soft, I guess what I'm looking for is people answering from experience.