java.lang.Object
com.cosium.spring.data.jpa.entity.graph.domain2.DynamicEntityGraph
All Implemented Interfaces:
EntityGraph

public class DynamicEntityGraph extends Object implements EntityGraph
Allows to create on-the-fly generated EntityGraph by defining its attribute paths.
Author:
Réda Housni Alaoui
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields inherited from interface com.cosium.spring.data.jpa.entity.graph.domain2.EntityGraph

    NOOP
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    buildQueryHint(javax.persistence.EntityManager entityManager, Class<?> entityType)
     
    boolean
     
    When the javax.persistence.fetchgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated as FetchType.LAZY
    fetching(List<String> attributePaths)
    When the javax.persistence.fetchgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated as FetchType.LAZY
    int
     
    When the javax.persistence.loadgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated according to their specified or default FetchType.
    loading(List<String> attributePaths)
    When the javax.persistence.loadgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated according to their specified or default FetchType.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.cosium.spring.data.jpa.entity.graph.domain2.EntityGraph

    execute
  • Constructor Details

    • DynamicEntityGraph

      public DynamicEntityGraph(EntityGraphType type, List<String> attributePaths)
      Parameters:
      attributePaths - The paths of attributes of this EntityGraph. You can refer to direct properties of the entity or nested properties via a property.nestedProperty. e.g. for a product entity: ["brand", "supplier.address"]
  • Method Details

    • loading

      public static DynamicEntityGraph.Builder loading()
      When the javax.persistence.loadgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated according to their specified or default FetchType.
      See Also:
    • loading

      public static DynamicEntityGraph loading(List<String> attributePaths)
      When the javax.persistence.loadgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated according to their specified or default FetchType.
      Parameters:
      attributePaths - The paths of attributes of this EntityGraph. You can refer to direct properties of the entity or nested properties via a property.nestedProperty. e.g. for a product entity: ["brand", "supplier.address"]
      See Also:
    • fetching

      public static DynamicEntityGraph.Builder fetching()
      When the javax.persistence.fetchgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated as FetchType.LAZY
      See Also:
    • fetching

      public static DynamicEntityGraph fetching(List<String> attributePaths)
      When the javax.persistence.fetchgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated as FetchType.LAZY
      Parameters:
      attributePaths - The paths of attributes of this EntityGraph. You can refer to direct properties of the entity or nested properties via a property.nestedProperty. e.g. for a product entity: ["brand", "supplier.address"]
      See Also:
    • builder

      public static DynamicEntityGraph.Builder builder(EntityGraphType type)
    • buildQueryHint

      public Optional<EntityGraphQueryHint> buildQueryHint(javax.persistence.EntityManager entityManager, Class<?> entityType)
      Specified by:
      buildQueryHint in interface EntityGraph
      Returns:
      A query hint to apply to a query. If empty, the entity graph will be ignored and therefore not applied to the query.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object