Login
JPA: Embeddable и OneToMany
243 просмотров
Перейти к просмотру всей ветки
scorpi_ постоялец
in Antwort Simple 13.03.14 10:51
Смотри JPA спек:
2.6 Collections of Embeddable Classes and Basic Types
A persistent field or property of an entity or embeddable class may correspond to a collection of a basic type or embeddable class (“element collection”). Such a collection, when specified as such by the ElementCollection annotation, is mapped by means of a collection table, as defined in Section 11.1.8. If the ElementCollection annotation (or XML equivalent) is not specified for the collection-valued field or property, the rules of Section 2.8 apply.
An embeddable class (including an embeddable class within another embeddable class) that is contained within an element collection must not contain an element collection, nor may it contain a relationship to an entity other than a many-to-one or one-to-one relationship. The embeddable class must be on the owning side of such a relationship and the relationship must be mapped by a foreign key mapping. (See Section 2.9.)
2.6 Collections of Embeddable Classes and Basic Types
A persistent field or property of an entity or embeddable class may correspond to a collection of a basic type or embeddable class (“element collection”). Such a collection, when specified as such by the ElementCollection annotation, is mapped by means of a collection table, as defined in Section 11.1.8. If the ElementCollection annotation (or XML equivalent) is not specified for the collection-valued field or property, the rules of Section 2.8 apply.
An embeddable class (including an embeddable class within another embeddable class) that is contained within an element collection must not contain an element collection, nor may it contain a relationship to an entity other than a many-to-one or one-to-one relationship. The embeddable class must be on the owning side of such a relationship and the relationship must be mapped by a foreign key mapping. (See Section 2.9.)