How to handle ElementCollection
Closed this issue · 1 comments
hantsy commented
In JPA there is ElementCollection to embed a collection of embeddable elements in the Entity, if possible add such a feature in NoSQL.
otaviojava commented
Hey @hantsy
We can already do it:
@Entity
public class OlympusGod {
@Id
private Long id;
@Column
private String name;
@Column
private Set<String> powers;
}
You can also explore subdocuments such as on MongoDB:
@Entity
public class Car {
@Id
private Long id;
@Column
private String name;
@Column
private Set<Piece> pieces;
}
@Entity
public class Piece {
@Column
private String name;
@Column
private Integer year;
}
Is that what you are looking for?