Interface JpaApplicationRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<ApplicationEntity,,Long> JpaBaseRepository<ApplicationEntity>,org.springframework.data.jpa.repository.JpaRepository<ApplicationEntity,,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<ApplicationEntity>,org.springframework.data.repository.PagingAndSortingRepository<ApplicationEntity,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<ApplicationEntity>,org.springframework.data.repository.Repository<ApplicationEntity,Long>
Application repository.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringFind any application records where they are not linked to any jobs and it's not linked to any commands and was created before the given time. -
Method Summary
Modifier and TypeMethodDescriptionfindUnusedApplications(Instant createdThreshold, int limit) Delete any application records where it's not linked to any jobs and it's not linked to any commands and was created before the given time.Get theApplicationEntitybut eagerly fetch all command base information as well.Get theApplicationEntitybut eagerly fetch all command DTO information as well.Get theApplicationEntitybut eagerly fetch all relational information needed to construct a DTO.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface com.netflix.genie.web.data.services.impl.jpa.repositories.JpaBaseRepository
deleteByIdIn, existsByUniqueId, findByUniqueId, findByUniqueIdMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, exists, findAll, findAll, findAll, findOneMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Field Details
-
FIND_UNUSED_APPLICATIONS_QUERY
Find any application records where they are not linked to any jobs and it's not linked to any commands and was created before the given time.- See Also:
-
-
Method Details
-
findUnusedApplications
@Query(value="SELECT id FROM applications WHERE created < :createdThreshold AND id NOT IN (SELECT DISTINCT(application_id) FROM commands_applications) AND id NOT IN (SELECT DISTINCT(application_id) FROM jobs_applications) LIMIT :limit", nativeQuery=true) Set<Long> findUnusedApplications(@Param("createdThreshold") Instant createdThreshold, @Param("limit") int limit) Delete any application records where it's not linked to any jobs and it's not linked to any commands and was created before the given time.- Parameters:
createdThreshold- The instant in time before which records should be considered for deletion. Exclusive.limit- Maximum number of IDs to return- Returns:
- The ids of the applications that are unused
-
getApplicationDto
@Query("SELECT a FROM ApplicationEntity a WHERE a.uniqueId = :id") @EntityGraph(value="Application.dto", type=LOAD) Optional<ApplicationEntity> getApplicationDto(@Param("id") String id) Get theApplicationEntitybut eagerly fetch all relational information needed to construct a DTO.- Parameters:
id- The unique identifier of the application to get- Returns:
- An
ApplicationEntitywith dto data loaded orOptional.empty()if no application with the given id exists
-
getApplicationAndCommands
@Query("SELECT a FROM ApplicationEntity a WHERE a.uniqueId = :id") @EntityGraph(value="Application.commands", type=LOAD) Optional<ApplicationEntity> getApplicationAndCommands(@Param("id") String id) Get theApplicationEntitybut eagerly fetch all command base information as well.- Parameters:
id- The unique identifier of the application to get- Returns:
- An
ApplicationEntitywith command data loaded orOptional.empty()if no application with the given id exists
-
getApplicationAndCommandsDto
@Query("SELECT a FROM ApplicationEntity a WHERE a.uniqueId = :id") @EntityGraph(value="Application.commands.dto", type=LOAD) Optional<ApplicationEntity> getApplicationAndCommandsDto(@Param("id") String id) Get theApplicationEntitybut eagerly fetch all command DTO information as well.- Parameters:
id- The unique identifier of the application to get- Returns:
- An
ApplicationEntitywith command data loaded orOptional.empty()if no application with the given id exists
-