Giter Site home page Giter Site logo

linecode / spring-data-jpa-entity-graph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cosium/spring-data-jpa-entity-graph

0.0 1.0 0.0 325 KB

Spring Data JPA extension allowing full dynamic usage of EntityGraph on repositories

License: MIT License

Java 99.91% Shell 0.09%

spring-data-jpa-entity-graph's Introduction

Gitter Travis branch Codecov branch

Maven Central 1.10.x Maven Central 1.11.x Maven Central 1.11.x Maven Central 2.1.x Maven Central 2.2.x Maven Central 2.3.x Maven Central Latest

Spring Data JPA EntityGraph

Life without spring-data-jpa-entity-graph

Spring Data JPA only supports EntityGraph through annotations.
Thus, for a repository method, you must select at most one EntityGraph before compilation.
This prevents you from choosing the best EntityGraph considering the runtime context ๐Ÿ’”

Life with spring-data-jpa-entity-graph

Thanks to spring-data-jpa-entity-graph, you can choose EntityGraph at runtime!
This choice is elegantly made by passing EntityGraph, as an argument, to any Spring Data JPA repository method ๐Ÿ˜

// This will apply 'Product.brand' named EntityGraph to findByLabel
productRepository.findByLabel("foo", EntityGraphs.named("Product.brand"));

// This will apply "product(brand, category, maker(country))" dynamic EntityGraph to findByLabel
productRepository.findByLabel(
            "foo", 
            // ProductEntityGraph was generated at compilation time
            ProductEntityGraph.____()
                              .brand()
                              .____
                              .category()
                              .____
                              .maker()
                              .country()
                              .____
                              .____()
);

Now run to the documentation !

Documentation

This library follows the Spring Data JPA versionning semantic.

spring-data-jpa branches Latest spring-data-jpa-entity-graph version Documentation
2.4.x Maven Central Latest 2.4.x documentation
2.3.x Maven Central Latest 2.3.x documentation
2.2.x Maven Central Latest 2.2.x documentation
2.1.x Maven Central 2.1.x 2.1.x documentation
2.0.x Maven Central 2.0.x 2.0.x documentation
1.11.x Maven Central 1.11.x 1.11.x documentation
1.10.x Maven Central 1.10.x 1.10.x documentation

For example, if you were using spring-data-jpa 2.2.x in your project, you would need to select any spring-data-jpa-entity-graph 2.2.x. Thus spring-data-jpa-entity-graph 2.2.8 would be eligible.

"Making JPA Great Again" talk

This talk was given at Paris JUG in January 2019.

The slides are in english.
The video is in french:
Alt text

Genesis

This project was created following the discussion in Spring Data Tracker issue DATAJPA-749 - Context enabled JPA 2.1 @EntityGraph .

spring-data-jpa-entity-graph's People

Contributors

czp3009 avatar dependabot[bot] avatar devnied avatar huijiewei avatar reda-alaoui avatar thyming avatar

Watchers

 avatar

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.