Giter Site home page Giter Site logo

Comments (3)

reda-alaoui avatar reda-alaoui commented on August 18, 2024

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.

reda-alaoui avatar reda-alaoui commented on August 18, 2024

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.

JamesPeters98 avatar JamesPeters98 commented on August 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.