-
Notifications
You must be signed in to change notification settings - Fork 54
Relationships
Igor Dianov edited this page May 29, 2024
·
2 revisions
GraphQL JPA Query engine will introspect JPA Entity Metadata entity class relationships to support ORM queries, i.e. given one to many relationship between Author and Book entities,
@Entity
public class Author {
@Id
Long id;
String name;
@OneToMany(mappedBy = "author", fetch = FetchType.LAZY)
Set<Book> books;
}
@Entity
public class Book {
@Id
Long id;
String title;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
Author author;