org.springframework.data.jpa.repository.QueryHints Java Examples

The following examples show how to use org.springframework.data.jpa.repository.QueryHints. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PostRepository.java    From POC with Apache License 2.0 6 votes vote down vote up
@Query("SELECT distinct p FROM Post p LEFT JOIN FETCH p.tags pt LEFT JOIN FETCH pt.tag JOIN p.details where p in :posts")
@QueryHints(@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_PASS_DISTINCT_THROUGH, value = "false"))
List<Post> findPostsWithAllDetails(@Param("posts") List<Post> postList);
 
Example #2
Source File: CachingJpaRepository.java    From stream-registry with Apache License 2.0 5 votes vote down vote up
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
List<T> findAll();
 
Example #3
Source File: QuestionRepository.java    From gazpachoquest with GNU General Public License v3.0 5 votes vote down vote up
@Query("select q from Question q where q.id in :questionIds")
@QueryHints(value = { @QueryHint(name = org.eclipse.persistence.config.QueryHints.BATCH_TYPE, value = "IN"),
        @QueryHint(name = org.eclipse.persistence.config.QueryHints.BATCH, value = "q.questionOptions"),
        @QueryHint(name = org.eclipse.persistence.config.QueryHints.BATCH, value = "q.subquestions"),
        @QueryHint(name = org.eclipse.persistence.config.QueryHints.BATCH, value = "q.translations"),
        @QueryHint(name = org.eclipse.persistence.config.QueryHints.BATCH, value = "questionOptions.translations"),
        @QueryHint(name = org.eclipse.persistence.config.QueryHints.BATCH, value = "subquestions.translations"),
        @QueryHint(name = org.eclipse.persistence.config.QueryHints.BATCH, value = "subquestions.questionOptions"), }, forCounting = false)
List<Question> findInList(@Param("questionIds")
List<Integer> questionIds);
 
Example #4
Source File: CarRepository.java    From spring-examples with GNU General Public License v3.0 4 votes vote down vote up
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")})
List<Car> findAll();
 
Example #5
Source File: CachingJpaRepository.java    From stream-registry with Apache License 2.0 4 votes vote down vote up
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
Optional<T> findById(ID id);
 
Example #6
Source File: CachingJpaRepository.java    From stream-registry with Apache License 2.0 4 votes vote down vote up
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
boolean existsById(ID id);
 
Example #7
Source File: CachingJpaRepository.java    From stream-registry with Apache License 2.0 4 votes vote down vote up
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
List<T> findAllById(Iterable<ID> ids);
 
Example #8
Source File: CachingJpaRepository.java    From stream-registry with Apache License 2.0 4 votes vote down vote up
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
<S extends T> List<S> findAll(Example<S> example);
 
Example #9
Source File: DictionaryRepository.java    From dpCms with Apache License 2.0 4 votes vote down vote up
@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
public List<Dictionary> findByType(int type);
 
Example #10
Source File: PostRepository.java    From POC with Apache License 2.0 4 votes vote down vote up
@Query("SELECT distinct p FROM Post p LEFT JOIN FETCH p.comments JOIN FETCH p.details d where d.createdBy = :user")
@QueryHints(@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_PASS_DISTINCT_THROUGH, value = "false"))
List<Post> findByDetailsCreatedBy(@Param("user") String userName);
 
Example #11
Source File: RunningExecutionPlanRepository.java    From score with Apache License 2.0 4 votes vote down vote up
@Query("from RunningExecutionPlan r where r.flowUUID = :flowUUID")
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")})
public List<RunningExecutionPlan> findByUuidCached(@Param("flowUUID") String flowUUID);
 
Example #12
Source File: SysOrgElementRepository.java    From mPaaS with Apache License 2.0 2 votes vote down vote up
/**
 * 获取组织架构层级关系(用于更新组织架构层级关系)
 *
 * @param tenantId
 * @return
 */
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")})
@Query("select s.fdId, p.fdId, p.fdHierarchyId, p.fdParentOrg.fdId, p.fdOrgType, p.fdTreeLevel from SysOrgElement s inner join s.fdParent p where s.fdOrgType > 1 and s.fdOrgType < 16 and s.fdIsAvailable = true and s.fdTenantId = :tenantId and (p.fdOrgType = 1 and (s.fdParentOrg is null or s.fdParentOrg <> p) or p.fdOrgType > 1 and (s.fdParentOrg is null and p.fdParentOrg is not null or s.fdParentOrg is not null and p.fdParentOrg is null or s.fdParentOrg <> p.fdParentOrg) or s.fdHierarchyId <> concat(concat(p.fdHierarchyId, s.fdId), 'x'))")
List<Object[]> findElementRelation(@Param("tenantId") int tenantId);
 
Example #13
Source File: SysOrgGroupRepository.java    From mPaaS with Apache License 2.0 2 votes vote down vote up
/**
 * 获取群组关联关系
 *
 * @param tenantId
 * @return
 */
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")})
@Query(value = "select fd_group_id, fd_element_id from sys_org_group_element left join sys_org_element on fd_element_id = fd_id where fd_org_type = 16 and fd_tenant_id = :tenantId", nativeQuery = true)
List<String[]> loadManyToMany(@Param("tenantId") int tenantId);