Questions tagged [entitygraph]

In JPA Entity Graphs give the ability to specify fetch plans.

In JPA Entity Graphs give the ability to specify fetch plans.

This is useful since it allows you to customise the data that is retrieved with a query or find operation. When working with mid to large size applications is common to display data from the same entity in different and many ways. In other cases, you just want to select a smallest set of information to optimize the performance of your application.

98 questions
0
votes
1 answer

Can we make Spring JPA Specifications work with EntityGraph?

I am implementing a dynamic query logic using JPA specifications on an entity. The entity is having multiple relations with other entities. I am running into the issue of generating too many queries while executing JPA specifications. Is there a…
user2885295
  • 329
  • 1
  • 4
  • 12
0
votes
1 answer

JPA EntityGraph DISTINCT with Parameter results in cartesian product

2 I have an entity with 4 1:n relationships @Entity @Table(name="REPORT_MESSAGE") @NamedEntityGraph(name=ReportMessage.GRAPH_ALL, attributeNodes= {@NamedAttributeNode("reportEvents"), @NamedAttributeNode("reportLabels"),…
Hans
  • 145
  • 9
0
votes
2 answers

Not able to fetch data with left join and join fetch together in JPQL query with entiy graphs as a hint

I am using Jpa 2.2 with Hibernate 5.3.7 final jar. Below are my entities and code for the test case is not executing correctly: Instructor Entity : @Entity @DynamicUpdate @DynamicInsert public class Instructor { @Id …
Vaneet Kataria
  • 575
  • 5
  • 14
0
votes
1 answer

NamedEntityGraph still resulting in lazy load exception

I have the following structure of entities: Route: -one-to-many-> :Stop: <-many-to-many-> :Child: <-many-to-many-> :Contact And so I've defined the following named entity graphs at the top of each entity class so I can optimize my queries for how…
Jordan Mackie
  • 2,264
  • 4
  • 25
  • 45
0
votes
1 answer

JPA Lazy with Entity Graph makes additional requests

Assume that I have 2 objects A and B One to One related and B is nested under A. B is Lazy initialized and proxied and also I have an Entity Graph to fetch B eagerly when loading A as follows. @NamedEntityGraph(name = "subGraph",attributeNodes =…
Denny
  • 11
  • 3
0
votes
0 answers

JPA Entity Graph using Builder pattern

I have a car table like this: +----+------+--------------+-----------+----------+------+ | Id | Name | Description | Make | Model | Year | +----+------+--------------+-----------+----------+------+ | 1 | A | something1 | Ford |…
Richard
  • 5,840
  • 36
  • 123
  • 208
0
votes
1 answer

jpa/hibernate load eagerly whole chain in auto relashionship

I'm using JPA Entity Graphs to eagerly load relationships. But, my problem is: The relation is an auto-relationship like this: public class X{ ... @OneToOne @JoinColumn(name = "foreign_key") protected @Getter @Setter X…
-1
votes
2 answers

How to define custom findAll methods in JpaRepository?

I have two api endpoints: /api/posts - Fetches list of paginated posts /api/countries/{country}/posts - Fetches list of paginated posts by country So I have following entity: @Data @Entity @Table(name =…
clzola
  • 1,925
  • 3
  • 30
  • 49
1 2 3 4 5 6
7