Class PostQueryLazyFetchBlockerFeature

java.lang.Object
cz.encircled.joiner.feature.PostQueryLazyFetchBlockerFeature
All Implemented Interfaces:
QueryFeature

public class PostQueryLazyFetchBlockerFeature extends Object implements QueryFeature
Use this query feature to prevent uninitialized lazy attributes from being fetched when accessed. Uninitialized attributes will be initialized with an empty collection or null for singular associations. This works only with Hibernate stateless sessions, which can be enabled at the query level or globally using JoinerProperties.setUseStatelessSessions(boolean))
  • Constructor Details

    • PostQueryLazyFetchBlockerFeature

      public PostQueryLazyFetchBlockerFeature(jakarta.persistence.EntityManager entityManager)
  • Method Details

    • postLoad

      public <T, R> void postLoad(JoinerQuery<T,R> request, List<R> result)
      Description copied from interface: QueryFeature
      This method is invoked after the result set is fetched, similar to JPA @PostLoad
      Specified by:
      postLoad in interface QueryFeature
      Type Parameters:
      T - query from
      R - query return type
      Parameters:
      request - initial joiner request
    • createEmptyValue

      public Object createEmptyValue(Type javaType)