Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle ElementCollection #109

Closed
hantsy opened this issue Aug 8, 2022 · 1 comment
Closed

How to handle ElementCollection #109

hantsy opened this issue Aug 8, 2022 · 1 comment

Comments

@hantsy
Copy link

hantsy commented Aug 8, 2022

In JPA there is ElementCollection to embed a collection of embeddable elements in the Entity, if possible add such a feature in NoSQL.

@otaviojava
Copy link
Contributor

otaviojava commented Aug 8, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants