Comments (3)
Hey,
If you use Hibernate, since https://hibernate.atlassian.net/browse/HHH-8776, the concept of "default" EntityGraph defined by this extension is not needed anymore.
You can just rely on your Entity annotations fetch type and apply an EntityGraph of type LOAD javax.persistence.loadgraph
.
Here is an example:
@Entity
class A {
@OneToOne(fetchType = EAGER)
private B b;
@OneToOne(fetchType = LAZY)
private C c;
}
// This will load b + c
aRepository.findById(1, new DynamicEntityGraph(LOAD, Collections.singletonList("c")));
from spring-data-jpa-entity-graph.
From https://docs.oracle.com/javaee/7/tutorial/persistence-entitygraphs001.htm :
To specify a load graph, set the javax.persistence.loadgraph property when you execute an EntityManager.find or query operation. A load graph consists of the fields explicitly specified in the EntityGraph instance plus any fields in the default entity graph.
from spring-data-jpa-entity-graph.
I had tried that but it doesn't work with Spring Boot and Spring Data which appears to just ignore FetchType Completely, that's why I'm using Entity Graphs in the first place
from spring-data-jpa-entity-graph.
Related Issues (20)
- Add support for Spring Data Jpa 3.1.x
- In Kotlin, specifying a default entity graph make query fail with Stackoverflow exception HOT 3
- Projection interface is not working with this HOT 1
- Expose method `findBy(Specification<T> spec, Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction, EntityGraph entityGraph)` in EntityGraphJpaSpecificationExecutor
- Errors during entity graph call to DB after upgrading Spring boot/spring-data-jpa-entity-graph
- Entity graph generation not working with Spring Boot 3 and Hibernate 6
- version 3.2.1 is losing jpa parameters type when using dynamic projections and generics
- Generic Method = > projection Bug HOT 1
- Optimizing ManyToMany Relationship Fetches with DynamicEntityGraph to Prevent N + 1 Queries in Spring Data JPA HOT 3
- Request documentation help HOT 1
- spring-data-jpa-entity-graph is incompatible with spring-data-envers HOT 2
- Add Generated annotation to result XEntityGraph classes HOT 1
- EntityGraphJpaRepository.findAllById(...) still returns Iterable instead of List HOT 1
- Compilation fails when entities have an array as a property
- Support for (Nested) Projections HOT 4
- Is there any Support for attributeNodes for Dynamic Entity Graphs? HOT 1
- Deprecate default EntityGraph concept
- GetEntityGraphAttributePaths() Method on DynamicEntityGraph HOT 3
- DefaultEntityGraph V2
- Plural attributes targeting non persistent entities are missing from generated entity graphs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-jpa-entity-graph.