jcrygier / graphql-jpa

JPA Implementation of GraphQL (builds on graphql-java)
MIT License
165 stars 46 forks source link

Embedded Annotation does not work correctly #48

Open ralfeis opened 6 years ago

ralfeis commented 6 years ago

Hi,

I had problems to use the @Embedded Annotation with the previous solution from:

26

This solution does not "flatten" the attributes, instead it keeps the "normal" java model hierarchy. So @Embeddable Annotations behave like @ManyToOne and @OneToOne Annotations.

The query looks like that: Spaceship (id: "1000"){ name, created { user {id}}, modified {date} }

where "created" and "modified" are of Typ DateAndUser, which is a @Embeddable Class

@Embeddable public class DateAndUser { public Date date; @ManyToOne public User user; }