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

Add support to @Embedded #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add support to @Embedded #85

wants to merge 2 commits into from

Conversation

gb
Copy link

@gb gb commented Sep 12, 2018

Fixes #84

@rahulsrivastava71
Copy link

why this change is required i am not able to get it, as the commit message also do not explain it

@gb
Copy link
Author

gb commented Oct 17, 2018

@rahulsrivastava71 sorry for the lack of the description, IMHO the code was self-explanatory, but let me try to fix it:

Given an entity A that contains an Object B as part of it table fields.

Example:

@Table
class A {
      @Id
      long id;
      @Column
      String field1; 
      @Embedded
      B embeddedField;
}

@Embeddable
class B {
     @Column
     String field2;
     @Column
     String field3;
     @Column
     String field4;
}

In JPA, we have a concept of Embedded/Embeddable.
If you save the entity A, all the fields from the Embeddable B should also be saved.

i.e. Table A { id, field1, field2, field3, field4 }

Without my PR, the embedded/embeddable is completely ignored, so, if you save A,
you only will persist Table A { id, field1 }, after my change, it works as expected.

@rahulsrivastava71
Copy link

LGTM!

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

Successfully merging this pull request may close these issues.

2 participants