Skip to content

feat: add JPA @EmbeddedId support #84

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

Merged
merged 5 commits into from
Mar 4, 2019
Merged

Conversation

igdianov
Copy link
Collaborator

@igdianov igdianov commented Mar 4, 2019

This is a new feature PR to support JPA @EmbeddedId attribute mappings submitted by @ludovicmotte,

Given, the following entity class definition with @EmbeddableId :

@Entity(name = "Boat")
@Data
public class Boat  {

    @Embeddable
    @Data
    public static class BoatId implements Serializable {
        private static final long serialVersionUID = 1L;

        String id;
        String country;
     }

    @EmbeddedId
    @GraphQLDescription("Primary Key for the Boat Class")
    BoatId boatId;

    @Embedded
    Engine engine;
}

Will generate schema to query entities using embedded id attributes:

Singular Query Field:

query { 
   Boat( boatId: { id: "1" country: "EN" } ) { 
       boatId { 
         id country 
       } 
       engine { 
         identification 
      } 
   } 
}

Plural Query Field:

query { 
  Boats { 
     select { 
        boatId( where: { id: { EQ: "1"} country: { EQ: "EN"}}) {
           id country
        } 
        engine { 
           identification 
        }
    } 
  } 
}

@igdianov igdianov changed the title Jpa embedded id support JPA @EmbeddedId support Mar 4, 2019
@igdianov igdianov changed the title JPA @EmbeddedId support feat: add JPA @EmbeddedId support Mar 4, 2019
@codecov
Copy link

codecov bot commented Mar 4, 2019

Codecov Report

Merging #84 into master will increase coverage by 1.43%.
The diff coverage is 93.45%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #84      +/-   ##
============================================
+ Coverage      60.4%   61.84%   +1.43%     
- Complexity      283      302      +19     
============================================
  Files            31       31              
  Lines          1816     1853      +37     
  Branches        282      286       +4     
============================================
+ Hits           1097     1146      +49     
+ Misses          593      580      -13     
- Partials        126      127       +1
Impacted Files Coverage Δ Complexity Δ
...query/schema/impl/GraphQLJpaSimpleDataFetcher.java 91.3% <92.85%> (+1.3%) 7 <6> (+4) ⬆️
...jpa/query/schema/impl/GraphQLJpaSchemaBuilder.java 86.69% <93.54%> (+0.74%) 80 <19> (+10) ⬆️
...hql/jpa/query/schema/impl/JpaPredicateBuilder.java 46.11% <0%> (+1.45%) 41% <0%> (+1%) ⬆️
...a/query/schema/impl/QraphQLJpaBaseDataFetcher.java 72.11% <0%> (+2.68%) 97% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac75192...282b486. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Mar 4, 2019

Codecov Report

Merging #84 into master will increase coverage by 1.43%.
The diff coverage is 93.45%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #84      +/-   ##
============================================
+ Coverage      60.4%   61.84%   +1.43%     
- Complexity      283      302      +19     
============================================
  Files            31       31              
  Lines          1816     1853      +37     
  Branches        282      286       +4     
============================================
+ Hits           1097     1146      +49     
+ Misses          593      580      -13     
- Partials        126      127       +1
Impacted Files Coverage Δ Complexity Δ
...query/schema/impl/GraphQLJpaSimpleDataFetcher.java 91.3% <92.85%> (+1.3%) 7 <6> (+4) ⬆️
...jpa/query/schema/impl/GraphQLJpaSchemaBuilder.java 86.69% <93.54%> (+0.74%) 80 <19> (+10) ⬆️
...hql/jpa/query/schema/impl/JpaPredicateBuilder.java 46.11% <0%> (+1.45%) 41% <0%> (+1%) ⬆️
...a/query/schema/impl/QraphQLJpaBaseDataFetcher.java 72.11% <0%> (+2.68%) 97% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac75192...282b486. Read the comment docs.

@igdianov igdianov merged commit 0def68d into master Mar 4, 2019
@igdianov igdianov mentioned this pull request Mar 4, 2019
@igdianov igdianov deleted the jpa_embedded_id_support branch March 4, 2019 20:43
miklemv added a commit to miklemv/graphql-jpa-query that referenced this pull request Mar 7, 2019
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.

1 participant