当前位置: 首页>>代码示例>>Java>>正文


Java QueryHint类代码示例

本文整理汇总了Java中javax.persistence.QueryHint的典型用法代码示例。如果您正苦于以下问题:Java QueryHint类的具体用法?Java QueryHint怎么用?Java QueryHint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QueryHint类属于javax.persistence包,在下文中一共展示了QueryHint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildQueryHints

import javax.persistence.QueryHint; //导入依赖的package包/类
private static void buildQueryHints(List<Element> elements, AnnotationDescriptor ann){
	List<QueryHint> queryHints = new ArrayList<QueryHint>( 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( (QueryHint) AnnotationFactory.create( hintDescriptor ) );
	}
	ann.setValue( "hints", queryHints.toArray( new QueryHint[queryHints.size()] ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:JPAOverriddenAnnotationReader.java

示例2: createNamedQuery

import javax.persistence.QueryHint; //导入依赖的package包/类
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()))

			//
			);

}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:22,代码来源:CreateXAnnotations.java

示例3: addLockModeOps

import javax.persistence.QueryHint; //导入依赖的package包/类
protected void addLockModeOps(InstructionList il, LockModeType lockMode,
        QueryHint[] hints) {
    // setQueryHints()
    processQueryHints(hints, il, TQ_CLASS);
    // setLockMode()
    if (lockMode != null && lockMode != LockModeType.NONE) {
        ObjectType lm = new ObjectType("javax.persistence.LockModeType");
        il.append(_factory.createFieldAccess(
            "javax.persistence.LockModeType", lockMode.name(), lm,
            Constants.GETSTATIC));
        il.append(_factory.createInvoke(TQ_CLASS, "setLockMode",
            new ObjectType(TQ_CLASS), new Type[] { lm },
            Constants.INVOKEINTERFACE));
    }
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:16,代码来源:DAOAnalysis.java

示例4: processQueryHints

import javax.persistence.QueryHint; //导入依赖的package包/类
protected void processQueryHints(QueryHint[] hints, InstructionList il,
        String queryClass) {
    for (QueryHint qh : hints) {
        il.append(new PUSH(_cp, qh.name()));
        il.append(new PUSH(_cp, qh.value()));
        il.append(_factory.createInvoke(queryClass, "setQueryHint",
            new ObjectType(queryClass), new Type[] { Type.STRING,
                    Type.OBJECT }, Constants.INVOKEINTERFACE));
    }
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:11,代码来源:DAOAnalysis.java

示例5: findInList

import javax.persistence.QueryHint; //导入依赖的package包/类
@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);
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:11,代码来源:QuestionRepository.java

示例6: applyRestrictions

import javax.persistence.QueryHint; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:35,代码来源:CdiQueryInvocationContext.java

示例7: extractQueryHints

import javax.persistence.QueryHint; //导入依赖的package包/类
private QueryHint[] extractQueryHints()
{
    org.apache.deltaspike.data.api.Query query = getRepositoryMethodMetadata().getQuery();        
    if (query != null && query.hints().length > 0)
    {
        return query.hints();
    }

    return null;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:11,代码来源:CdiQueryInvocationContext.java

示例8: findByType

import javax.persistence.QueryHint; //导入依赖的package包/类
@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
public List<Dictionary> findByType(int type);
 
开发者ID:summerDp,项目名称:dpCms,代码行数:3,代码来源:DictionaryRepository.java

示例9: AND

import javax.persistence.QueryHint; //导入依赖的package包/类
@QueryHints(value = @QueryHint(name = HINT_FETCH_SIZE, value = "1"))
@Query("SELECT r FROM RouteDataRevision r WHERE validFrom <= :date AND (validTo >= :date OR validTo IS NULL)")
Stream<RouteDataRevision> findValid(@Param("date") Date date);
 
开发者ID:Contargo,项目名称:iris,代码行数:4,代码来源:RouteDataRevisionRepository.java

示例10: findByPopulationGreaterThan

import javax.persistence.QueryHint; //导入依赖的package包/类
@QueryHints(value = { @QueryHint (name = "org.hibernate.cacheable", value = "true")})
List<Country> findByPopulationGreaterThan(Integer population);
 
开发者ID:danielme-com,项目名称:Spring-Data-JPA-Demo,代码行数:3,代码来源:CountryRepository.java

示例11: findByUuidCached

import javax.persistence.QueryHint; //导入依赖的package包/类
@Query("from RunningExecutionPlan r where r.flowUUID = :flowUUID")
@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
public List<RunningExecutionPlan> findByUuidCached(@Param("flowUUID") String flowUUID);
 
开发者ID:CloudSlang,项目名称:score,代码行数:4,代码来源:RunningExecutionPlanRepository.java

示例12: findById

import javax.persistence.QueryHint; //导入依赖的package包/类
@QueryHints(value = { @QueryHint(name = "org.hibernate.readOnly", value = "true")})
Person findById(Long id);
 
开发者ID:apetrelli,项目名称:samplegwt,代码行数:3,代码来源:PersonRepository.java

示例13: findAll

import javax.persistence.QueryHint; //导入依赖的package包/类
@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true")
, @QueryHint(name = "org.hibernate.cacheRegion", value = "omoikane.entities.Usuario") } )
@Query("FROM Usuario u")
List<Usuario>  findAll();
 
开发者ID:ZooMMX,项目名称:Omoikane,代码行数:5,代码来源:UsuarioRepo.java

示例14: countIt

import javax.persistence.QueryHint; //导入依赖的package包/类
@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true")
, @QueryHint(name = "org.hibernate.cacheRegion", value = "omoikane.entities.Usuario") } )
@Query("SELECT COUNT(*) as count FROM Usuario u")
Long countIt();
 
开发者ID:ZooMMX,项目名称:Omoikane,代码行数:5,代码来源:UsuarioRepo.java

示例15: findBy

import javax.persistence.QueryHint; //导入依赖的package包/类
@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);
 
开发者ID:apache,项目名称:deltaspike,代码行数:6,代码来源:SimpleIntermediateRepository.java


注:本文中的javax.persistence.QueryHint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。