• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RepositoryQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
protected RepositoryQuery resolveQuery(EbeanQueryMethod method, EbeanServer ebeanServer, NamedQueries namedQueries) {
  RepositoryQuery query = EbeanQueryFactory.INSTANCE.fromQueryAnnotation(method, ebeanServer, evaluationContextProvider);

  if (null != query) {
    return query;
  }

  String name = method.getNamedQueryName();
  if (namedQueries.hasQuery(name)) {
    return EbeanQueryFactory.INSTANCE.fromMethodWithQueryString(method, ebeanServer, namedQueries.getQuery(name),
        evaluationContextProvider);
  }

  query = NamedEbeanQuery.lookupFrom(method, ebeanServer);

  if (null != query) {
    return query;
  }

  throw new IllegalStateException(
      String.format("Did neither find a NamedQuery nor an annotated query for method %s!", method));
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:24,代码来源:EbeanQueryLookupStrategy.java


示例2: installAclProxy

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
private void installAclProxy(RepositoryQuery query) {
  CriteriaQuery<?> criteriaQuery = criteriaQuery();
  if (criteriaQuery == null) {
    logger.warn("Unable to install ACL Jpa Specification for method '" + method
            + "' and query: " + query + " ; query methods with Pageable/Sort are not (yet) supported");
    return;
  }
  this.cachedCriteriaQuery = criteriaQuery;
  this.root = root(cachedCriteriaQuery);

  try {
    this.aclPredicateTargetSource = installAclPredicateTargetSource();
  } catch (Exception e) {
    logger.warn(
        "Unable to install ACL Jpa Specification for method '" + method + "' and query: " + query + " : " +
        getStackTrace(e));
  }
}
 
开发者ID:lordlothar99,项目名称:strategy-spring-security-acl,代码行数:19,代码来源:AclJpaQuery.java


示例3: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, NamedQueries namedQueries) {

	SolrQueryMethod queryMethod = new SolrQueryMethod(method, metadata, entityInformationCreator);
	String namedQueryName = queryMethod.getNamedQueryName();

	SolrOperations solrOperations = selectSolrOperations(metadata);

	if (namedQueries.hasQuery(namedQueryName)) {
		String namedQuery = namedQueries.getQuery(namedQueryName);
		return new StringBasedSolrQuery(namedQuery, queryMethod, solrOperations);
	} else if (queryMethod.hasAnnotatedQuery()) {
		return new StringBasedSolrQuery(queryMethod, solrOperations);
	} else {
		return new PartTreeSolrQuery(queryMethod, solrOperations);
	}
}
 
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:18,代码来源:SolrRepositoryFactory.java


示例4: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
		NamedQueries namedQueries) {

	QueryMethod queryMethod = new QueryMethod(method, metadata, factory);

	Constructor<? extends KeyValuePartTreeQuery> constructor = (Constructor<? extends KeyValuePartTreeQuery>) ClassUtils
			.getConstructorIfAvailable(this.repositoryQueryType, QueryMethod.class, EvaluationContextProvider.class,
					KeyValueOperations.class, Class.class);

	Assert.state(constructor != null,
			String.format(
					"Constructor %s(QueryMethod, EvaluationContextProvider, KeyValueOperations, Class) not available!",
					ClassUtils.getShortName(this.repositoryQueryType)));

	return BeanUtils.instantiateClass(constructor, queryMethod, evaluationContextProvider, this.keyValueOperations,
			this.queryCreator);
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:20,代码来源:KeyValueRepositoryFactory.java


示例5: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
protected RepositoryQuery resolveQuery(JdbcQueryMethod method, NamedQueries namedQueries) {
    PartTree tree = new PartTree(method.getName(), method.getEntityInformation().getJavaType());
    JdbcByNameRepositoryQueryCreator creator = new JdbcByNameRepositoryQueryCreator(method, tree, generator, template,
                                                                                    tableDescription, rowMapper);
    return creator.createQuery();
}
 
开发者ID:rubasace,项目名称:spring-data-jdbc,代码行数:8,代码来源:JdbcQueryLookupStrategy.java


示例6: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata,
                                    ProjectionFactory factory, NamedQueries namedQueries) {
    final DocumentDbQueryMethod queryMethod = new DocumentDbQueryMethod(method, metadata, factory);

    Assert.notNull(queryMethod, "queryMethod must not be null!");
    Assert.notNull(dbOperations, "dbOperations must not be null!");
    return new PartTreeDocumentDbQuery(queryMethod, dbOperations);

}
 
开发者ID:Microsoft,项目名称:spring-data-documentdb,代码行数:11,代码来源:DocumentDbRepositoryFactory.java


示例7: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata repositoryMetadata, ProjectionFactory projectionFactory, NamedQueries namedQueries) {
    if (method.getAnnotation(MybatisQuery.class) != null) {
        log.info(repositoryMetadata.getRepositoryInterface().getName()+"."+method.getName()+" 为mybatis方法。 ");
        return new MybatisRepositoryQuery(sqlSessionTemplate , method , repositoryMetadata) ;
    } else {
        return jpaQueryLookupStrategy.resolveQuery(method, repositoryMetadata, projectionFactory,namedQueries);
    }
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:10,代码来源:GenericQueryLookupStrategy.java


示例8: createRepositoryFactory

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
protected TarantoolRepositoryFactory createRepositoryFactory(
        KeyValueOperations operations,
        Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
        Class<? extends RepositoryQuery> repositoryQueryType
) {
    return new TarantoolRepositoryFactory(operations, queryCreator, repositoryQueryType);
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:9,代码来源:TarantoolRepositoryFactoryBean.java


示例9: TarantoolRepositoryFactory

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
public TarantoolRepositoryFactory(
        KeyValueOperations keyValueOperations,
        Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
        Class<? extends RepositoryQuery> repositoryQueryType
) {
    super(keyValueOperations, queryCreator, repositoryQueryType);
    this.keyValueOperations = keyValueOperations;
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:9,代码来源:TarantoolRepositoryFactory.java


示例10: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory, NamedQueries namedQueries) {

    SnowdropQueryMethod queryMethod = new SnowdropQueryMethod(method, metadata, factory);
    String namedQueryName = queryMethod.getNamedQueryName();

    if (namedQueries.hasQuery(namedQueryName)) {
        String namedQuery = namedQueries.getQuery(namedQueryName);
        return new SnowdropStringQuery(queryMethod, snowdropOperations, namedQuery);
    } else if (queryMethod.hasAnnotatedQuery()) {
        return new SnowdropStringQuery(queryMethod, snowdropOperations, queryMethod.getAnnotatedQuery());
    }
    return new SnowdropPartQuery(queryMethod, snowdropOperations);
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:15,代码来源:SnowdropRepositoryFactory.java


示例11: ObjectifyRepositoryFactory

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
public ObjectifyRepositoryFactory(Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
                                  Class<? extends RepositoryQuery> repositoryQueryType,
                                  MappingContext<?, ?> mappingContext) {
    this.queryCreator = queryCreator;
    this.repositoryQueryType = repositoryQueryType;
    this.mappingContext = mappingContext;
}
 
开发者ID:nhuttrung,项目名称:spring-data-objectify,代码行数:8,代码来源:ObjectifyRepositoryFactory.java


示例12: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
                                    NamedQueries namedQueries) {
    QueryMethod queryMethod = new QueryMethod(method, metadata, factory);
    
    return new ObjectifyRepositoryQuery(queryMethod);
}
 
开发者ID:nhuttrung,项目名称:spring-data-objectify,代码行数:8,代码来源:ObjectifyQueryLookupStrategy.java


示例13: lookupFrom

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
/**
 * Looks up a named query for the given {@link org.springframework.data.repository.query.QueryMethod}.
 *
 * @param method
 * @return
 */
public static RepositoryQuery lookupFrom(EbeanQueryMethod method, EbeanServer ebeanServer) {
  final String queryName = method.getNamedQueryName();

  LOG.debug("Looking up named query {}", queryName);

  try {
    io.ebean.Query query = ebeanServer.createNamedQuery(method.getEntityInformation().getJavaType(), queryName);
    return new NamedEbeanQuery(method, ebeanServer, query);
  } catch (PersistenceException e) {
    LOG.debug("Did not find named query {}", queryName);
    return null;
  }
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:20,代码来源:NamedEbeanQuery.java


示例14: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
protected RepositoryQuery resolveQuery(MybatisQueryMethod method, NamedQueries namedQueries) {
    try {
        return new PartTreeMybatisQuery(context, sqlSessionTemplate, dialect, method);
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException(
                String.format("Could not create query metamodel for method %s!", method.toString()), e);
    }
}
 
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:10,代码来源:MybatisQueryLookupStrategy.java


示例15: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
		NamedQueries namedQueries) {
	if (method.getAnnotation(TemplateQuery.class) == null) {
		return jpaQueryLookupStrategy.resolveQuery(method, metadata, factory, namedQueries);
	}
	else {
		return new FreemarkerTemplateQuery(new JpaQueryMethod(method, metadata, factory, extractor), entityManager);
	}
}
 
开发者ID:slyak,项目名称:spring-data-jpa-extra,代码行数:11,代码来源:TemplateQueryLookupStrategy.java


示例16: VaultRepositoryFactory

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
public VaultRepositoryFactory(KeyValueOperations keyValueOperations,
		Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
		Class<? extends RepositoryQuery> repositoryQueryType) {
	super(keyValueOperations, queryCreator, repositoryQueryType);

	this.operations = keyValueOperations;
}
 
开发者ID:spring-projects,项目名称:spring-vault,代码行数:8,代码来源:VaultRepositoryFactory.java


示例17: createRepositoryFactory

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
protected VaultRepositoryFactory createRepositoryFactory(
		KeyValueOperations operations,
		Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
		Class<? extends RepositoryQuery> repositoryQueryType) {

	return new VaultRepositoryFactory(operations, queryCreator, repositoryQueryType);
}
 
开发者ID:spring-projects,项目名称:spring-vault,代码行数:9,代码来源:VaultRepositoryFactoryBean.java


示例18: resolveQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata repositoryMetadata,
                                    ProjectionFactory projectionFactory, NamedQueries namedQueries) {
  if (!isAggregateQueryAnnotated(method)) {
    return parentQueryLookupStrategy.resolveQuery(method, repositoryMetadata, projectionFactory, namedQueries);
  }
  else {
    return new AggregateMongoQuery(method, repositoryMetadata, mongoOperations, projectionFactory, queryExecutor);
  }
}
 
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:11,代码来源:AggregateQuerySupportingRepositoryFactory.java


示例19: testCreateAggregateQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
@Test(dataProvider = "queryMethods", expectedExceptions = {NullPointerException.class, IllegalArgumentException.class})
public void testCreateAggregateQuery(String methodName) throws Exception {
  AggregateQuerySupportingRepositoryFactory factory = new AggregateQuerySupportingRepositoryFactory(mongoOperations,
                                                                                                    queryExecutor);
  QueryLookupStrategy lookupStrategy = factory.getQueryLookupStrategy(CREATE_IF_NOT_FOUND, evaluationContextProvider);

  Method method = TestAggregateRepository22.class.getMethod(methodName);
  RepositoryMetadata repositoryMetadata = new DefaultRepositoryMetadata(TestAggregateRepository22.class);
  ProjectionFactory projectionFactory = new SpelAwareProxyProjectionFactory();
  RepositoryQuery query = lookupStrategy.resolveQuery(method, repositoryMetadata, projectionFactory, null);
  assertNotNull(query);
  Object object = query.execute(new Object[0]);
  assertNull(object);
}
 
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:15,代码来源:AggregateQueryProvider2Test.java


示例20: AclJpaQuery

import org.springframework.data.repository.query.RepositoryQuery; //导入依赖的package包/类
public AclJpaQuery(Method method, RepositoryQuery query, Class<?> domainType, EntityManager em,
    JpaSpecProvider<Object> jpaSpecProvider) {
  this.method = method;
  this.query = query;
  this.domainType = domainType;
  this.em = em;
  this.jpaSpecProvider = jpaSpecProvider;
  installAclProxy(query);
}
 
开发者ID:lordlothar99,项目名称:strategy-spring-security-acl,代码行数:10,代码来源:AclJpaQuery.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ApplicationInstanceInfo类代码示例发布时间:2022-05-21
下一篇:
Java DelimiterBasedFrameDecoder类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap