/** * Retrieves an Action with all lazy attributes. * * @param actionId * the ID of the action * @return the found {@link Action} */ @EntityGraph(value = "Action.all", type = EntityGraphType.LOAD) Optional<Action> getById(Long actionId);
/** * Retrieves an Action with all lazy attributes. * * @param actionId * the ID of the action * @return the found {@link Action} */ @EntityGraph(value = "Action.all", type = EntityGraphType.LOAD) Optional<Action> getById(Long actionId);
/** * Retrieves the oldest {@link Action} that is active and referring to the * given {@link Target}. * * @param sort * order * @param controllerId * the target to find assigned actions * @param active * the action active flag * * @return the found {@link Action} */ @EntityGraph(value = "Action.ds", type = EntityGraphType.LOAD) Optional<Action> findFirstByTargetControllerIdAndActive(Sort sort, String controllerId, boolean active);
/** * Finds all status updates for the defined action and target including * {@link ActionStatus#getMessages()}. * * @param pageReq * for page configuration * @param target * to look for * @param actionId * to look for * @return Page with found targets */ @EntityGraph(value = "ActionStatus.withMessages", type = EntityGraphType.LOAD) Page<ActionStatus> getByActionId(Pageable pageReq, Long actionId);
@EntityGraph(value = "StockProduct.detail", type = EntityGraphType.LOAD) Page<StockProduct> findByIndices(Index index, Pageable pageable); List<StockProduct> findByIdIn(List<String> asList);
@EntityGraph(attributePaths = { "owner" }) public KeysetAwarePage<Cat> findAll(Specification<Cat> specification, Pageable pageable); }
/** * Finds all status updates for the defined action and target including * {@link ActionStatus#getMessages()}. * * @param pageReq * for page configuration * @param target * to look for * @param actionId * to look for * @return Page with found targets */ @EntityGraph(value = "ActionStatus.withMessages", type = EntityGraphType.LOAD) Page<ActionStatus> getByActionId(Pageable pageReq, Long actionId);
/** * Retrieving all actions referring to the first group of a rollout. * * @param pageable * page parameters * @param rollout * the rollout the actions belong to * @param actionStatus * the status the actions have * @return the actions referring a specific rollout and a specific parent * rolloutgroup in a specific status */ @EntityGraph(attributePaths = { "target" }, type = EntityGraphType.LOAD) Page<Action> findByRolloutIdAndRolloutGroupParentIsNullAndStatus(Pageable pageable, Long rollout, Status actionStatus);
/** * Retrieves the oldest {@link Action} that is active and referring to the * given {@link Target}. * * @param sort * order * @param controllerId * the target to find assigned actions * @param active * the action active flag * * @return the found {@link Action} */ @EntityGraph(value = "Action.ds", type = EntityGraphType.LOAD) Optional<Action> findFirstByTargetControllerIdAndActive(Sort sort, String controllerId, boolean active);
/** * Retrieving all actions referring to the first group of a rollout. * * @param pageable * page parameters * @param rollout * the rollout the actions belong to * @param actionStatus * the status the actions have * @return the actions referring a specific rollout and a specific parent * rolloutgroup in a specific status */ @EntityGraph(attributePaths = { "target" }, type = EntityGraphType.LOAD) Page<Action> findByRolloutIdAndRolloutGroupParentIsNullAndStatus(Pageable pageable, Long rollout, Status actionStatus);
/** * * Retrieves all {@link Action}s which are active and referring to the given * target Ids and distribution set not requiring migration step. * * @param targetIds * the IDs of targets for the actions * @return the found list of {@link Action}s */ @EntityGraph(attributePaths = { "target" }, type = EntityGraphType.LOAD) @Query("SELECT a FROM JpaAction a WHERE a.active = true AND a.distributionSet.requiredMigrationStep = false AND a.target IN ?1") List<JpaAction> findByActiveAndTargetIdInAndDistributionSetNotRequiredMigrationStep(Collection<Long> targetIds);
/** * * Retrieves all {@link Action}s which are active and referring to the given * target Ids and distribution set required migration step. * * @param targetIds * the IDs of targets for the actions * @return the found list of {@link Action}s */ @EntityGraph(attributePaths = { "target" }, type = EntityGraphType.LOAD) @Query("SELECT a FROM JpaAction a WHERE a.active = true AND a.distributionSet.requiredMigrationStep = false AND a.target IN ?1") List<JpaAction> findByActiveAndTargetIdInAndDistributionSetNotRequiredMigrationStep(Collection<Long> targetIds);
@Query("SELECT messages FROM Message messages") @EntityGraph(type = EntityGraph.EntityGraphType.LOAD, value = "load.eager.all") List<Message> findAllEager(); }
/** * 2. @EntityGraph */ @EntityGraph(attributePaths = "subjects") @Query("select a from Academy a") List<Academy> findAllEntityGraph();
/** * 6. Academy+Subject+Teacher를 @EntityGraph 로 조회 */ @EntityGraph(attributePaths = {"subjects", "subjects.teacher"}) @Query("select DISTINCT a from Academy a") List<Academy> findAllEntityGraphWithTeacher();
/** * 4. @EntityGraph + distinct 를 통한 조회 */ @EntityGraph(attributePaths = "subjects") @Query("select DISTINCT a from Academy a") List<Academy> findAllEntityGraphDistinct();
/** * * Retrieves all {@link Action}s which are active and referring to the given * target Ids and distribution set required migration step. * * @param targetIds * the IDs of targets for the actions * @param notStatus * the status which the actions should not have * @return the found list of {@link Action}s */ @EntityGraph(attributePaths = { "target" }, type = EntityGraphType.LOAD) @Query("SELECT a FROM JpaAction a WHERE a.active = true AND a.distributionSet.requiredMigrationStep = false AND a.target IN ?1 AND a.status != ?2") List<JpaAction> findByActiveAndTargetIdInAndActionStatusNotEqualToAndDistributionSetNotRequiredMigrationStep( Collection<Long> targetIds, Action.Status notStatus);
/** * * Retrieves all {@link Action}s which are active and referring to the given * target Ids and distribution set not requiring migration step. * * @param targetIds * the IDs of targets for the actions * @param notStatus * the status which the actions should not have * @return the found list of {@link Action}s */ @EntityGraph(attributePaths = { "target" }, type = EntityGraphType.LOAD) @Query("SELECT a FROM JpaAction a WHERE a.active = true AND a.distributionSet.requiredMigrationStep = false AND a.target IN ?1 AND a.status != ?2") List<JpaAction> findByActiveAndTargetIdInAndActionStatusNotEqualToAndDistributionSetNotRequiredMigrationStep( Collection<Long> targetIds, Action.Status notStatus);
@EntityGraph(attributePaths = {"userRoles", "userRoles.userRole"}) @Query("select distinct u from User u where u.email=:email") User findByEmail(@Param("email") String email); }
/** * Retrieves all {@link Action}s of a specific target and given active flag * ordered by action ID. Loads also the lazy * {@link Action#getDistributionSet()} field. * * @param pageable * page parameters * @param controllerId * to search for * @param active * {@code true} for all actions which are currently active, * {@code false} for inactive * @return a list of actions */ @EntityGraph(value = "Action.ds", type = EntityGraphType.LOAD) @Query("Select a from JpaAction a where a.target.controllerId = :controllerId and a.active = :active") Page<Action> findByActiveAndTarget(Pageable pageable, @Param("controllerId") String controllerId, @Param("active") boolean active);