javax.persistence.QueryHint源码实例Demo

类javax.persistence.QueryHint源码实例Demo

下面列出了javax.persistence.QueryHint 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: JPAOverriddenAnnotationReader.java
private static void buildQueryHints(List<Element> elements, AnnotationDescriptor ann){
	List<QueryHint> queryHints = new ArrayList<>( elements.size() );
	for ( Element hint : elements ) {
		AnnotationDescriptor hintDescriptor = new AnnotationDescriptor( QueryHint.class );
		String value = hint.attributeValue( "name" );
		if ( value == null ) {
			throw new AnnotationException( "<hint> without name. " + SCHEMA_VALIDATION );
		}
		hintDescriptor.setValue( "name", value );
		value = hint.attributeValue( "value" );
		if ( value == null ) {
			throw new AnnotationException( "<hint> without value. " + SCHEMA_VALIDATION );
		}
		hintDescriptor.setValue( "value", value );
		queryHints.add( AnnotationFactory.create( hintDescriptor ) );
	}
	ann.setValue( "hints", queryHints.toArray( new QueryHint[queryHints.size()] ) );
}
 
源代码2 项目: hyperjaxb3   文件: CreateXAnnotations.java
public XAnnotation<javax.persistence.NamedQuery> createNamedQuery(
		NamedQuery source) {
	return source == null ? null :
	//
			new XAnnotation<javax.persistence.NamedQuery>(
					javax.persistence.NamedQuery.class,
					//
					AnnotationUtils.create("query", source.getQuery()),
					//
					AnnotationUtils.create("hints",
							createQueryHint(source.getHint()),
							QueryHint.class),
					//
					AnnotationUtils.create("name", source.getName()),
					AnnotationUtils.create("lockMode",
							createLockMode(source.getLockMode()))

			//
			);

}
 
源代码3 项目: gazpachoquest   文件: QuestionRepository.java
@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);
 
源代码4 项目: deltaspike   文件: CdiQueryInvocationContext.java
public Query applyRestrictions(Query query)
{
    Parameters params = getParams();
    Method method = getMethod();
    
    if (params.hasSizeRestriction())
    {
        query.setMaxResults(params.getSizeRestriciton());
    }
    
    if (params.hasFirstResult())
    {
        query.setFirstResult(params.getFirstResult());
    }
    
    LockModeType lockMode = extractLockMode();
    if (lockMode != null)
    {
        query.setLockMode(lockMode);
    }
    
    QueryHint[] hints = extractQueryHints();
    if (hints != null)
    {
        for (QueryHint hint : hints)
        {
            query.setHint(hint.name(), hint.value());
        }
    }

    applyEntityGraph(query, method);
    query = applyJpaQueryPostProcessors(query);
    return query;
}
 
源代码5 项目: deltaspike   文件: CdiQueryInvocationContext.java
private QueryHint[] extractQueryHints()
{
    org.apache.deltaspike.data.api.Query query = getRepositoryMethodMetadata().getQuery();        
    if (query != null && query.hints().length > 0)
    {
        return query.hints();
    }

    return null;
}
 
源代码6 项目: spring-examples   文件: CarRepository.java
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")})
List<Car> findAll();
 
源代码7 项目: stream-registry   文件: CachingJpaRepository.java
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
Optional<T> findById(ID id);
 
源代码8 项目: stream-registry   文件: CachingJpaRepository.java
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
boolean existsById(ID id);
 
源代码9 项目: stream-registry   文件: CachingJpaRepository.java
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
List<T> findAll();
 
源代码10 项目: stream-registry   文件: CachingJpaRepository.java
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
List<T> findAllById(Iterable<ID> ids);
 
源代码11 项目: stream-registry   文件: CachingJpaRepository.java
@QueryHints(@QueryHint(name = CACHEABLE, value = "true"))
<S extends T> List<S> findAll(Example<S> example);
 
源代码12 项目: dpCms   文件: DictionaryRepository.java
@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
public List<Dictionary> findByType(int type);
 
源代码13 项目: POC   文件: PostRepository.java
@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);
 
源代码14 项目: POC   文件: PostRepository.java
@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);
 
源代码15 项目: score   文件: RunningExecutionPlanRepository.java
@Query("from RunningExecutionPlan r where r.flowUUID = :flowUUID")
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")})
public List<RunningExecutionPlan> findByUuidCached(@Param("flowUUID") String flowUUID);
 
源代码16 项目: deltaspike   文件: SimpleIntermediateRepository.java
@Query(hints = {
        @QueryHint(name = "openjpa.hint.OptimizeResultCount", value = "some.invalid.value"),
        @QueryHint(name = "org.hibernate.comment", value = "I'm a little comment short and stout")
})
Simple findBy(Long id);
 
源代码17 项目: mPaaS   文件: SysOrgElementRepository.java
/**
 * 获取组织架构层级关系(用于更新组织架构层级关系)
 *
 * @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);
 
源代码18 项目: mPaaS   文件: SysOrgGroupRepository.java
/**
 * 获取群组关联关系
 *
 * @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);
 
源代码19 项目: spring-boot   文件: UserRepository.java
/**
 * Retrieve users by their lastname. The finder {@literal User.findByLastname} is declared in
 * {@literal META-INF/orm.xml} .
 *
 * @param lastname
 * @return all users with the given lastname
 */
@QueryHints({@QueryHint(name = "foo", value = "bar")})
List<User> findByLastname(String lastname);
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法