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

Entity with field another entity #369

Closed
Jparrgam opened this issue Jul 8, 2020 · 1 comment
Closed

Entity with field another entity #369

Jparrgam opened this issue Jul 8, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists feature Request and implementation of a feature (release drafter)

Comments

@Jparrgam
Copy link

Jparrgam commented Jul 8, 2020

Hi @vitusortner, i have a question it is possible that an entity can contain other entities for example:
@Entity(tableName: 'configuration') class Configuration { Settings settings; }

@Entity(tableName: 'configuration') class Settings { //fields }

@mqus
Copy link
Collaborator

mqus commented Jul 12, 2020

There are mainly two ways of achieving what you want and both are sadly not yet available.

  1. If you want Settings to be its own table in the database and query it like one, then you want something like @Relation (Feature Request Support relations with @Relation annotation #47 )
  2. If you want Settings to be embedded into Configuration and the table of Configuration simply including all the fields of Settings, then you want @Embedded (Feature Request Support embedded objects #9, Implementation: Add support for embedded objects #328 )

As this is mainly a duplicate of those two features, I will close this as a duplicate. If you are disagreeing, please reopen :)

@mqus mqus closed this as completed Jul 12, 2020
@mqus mqus added duplicate This issue or pull request already exists feature Request and implementation of a feature (release drafter) labels Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feature Request and implementation of a feature (release drafter)
Development

No branches or pull requests

2 participants