Java Code Examples for org.springframework.data.repository.core.NamedQueries#hasQuery()
The following examples show how to use
org.springframework.data.repository.core.NamedQueries#hasQuery() .
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: Neo4jQueryLookupStrategy.java From sdn-rx with Apache License 2.0 | 6 votes |
@Override public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory, NamedQueries namedQueries) { Neo4jQueryMethod queryMethod = new Neo4jQueryMethod(method, metadata, factory); String namedQueryName = queryMethod.getNamedQueryName(); if (namedQueries.hasQuery(namedQueryName)) { return StringBasedNeo4jQuery.create(neo4jOperations, mappingContext, evaluationContextProvider, queryMethod, namedQueries.getQuery(namedQueryName)); } else if (queryMethod.hasQueryAnnotation()) { return StringBasedNeo4jQuery.create(neo4jOperations, mappingContext, evaluationContextProvider, queryMethod); } else { return PartTreeNeo4jQuery.create(neo4jOperations, mappingContext, queryMethod); } }
Example 2
Source File: ReactiveNeo4jQueryLookupStrategy.java From sdn-rx with Apache License 2.0 | 6 votes |
@Override public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory, NamedQueries namedQueries) { Neo4jQueryMethod queryMethod = new ReactiveNeo4jQueryMethod(method, metadata, factory); String namedQueryName = queryMethod.getNamedQueryName(); if (namedQueries.hasQuery(namedQueryName)) { return ReactiveStringBasedNeo4jQuery .create(neo4jOperations, mappingContext, evaluationContextProvider, queryMethod, namedQueries.getQuery(namedQueryName)); } else if (queryMethod.hasQueryAnnotation()) { return ReactiveStringBasedNeo4jQuery .create(neo4jOperations, mappingContext, evaluationContextProvider, queryMethod); } else { return ReactivePartTreeNeo4jQuery.create(neo4jOperations, mappingContext, queryMethod); } }
Example 3
Source File: ArangoRepositoryFactory.java From spring-data with Apache License 2.0 | 6 votes |
@Override public RepositoryQuery resolveQuery( final Method method, final RepositoryMetadata metadata, final ProjectionFactory factory, final NamedQueries namedQueries) { final ArangoQueryMethod queryMethod = new ArangoQueryMethod(method, metadata, factory); final String namedQueryName = queryMethod.getNamedQueryName(); if (namedQueries.hasQuery(namedQueryName)) { final String namedQuery = namedQueries.getQuery(namedQueryName); return new StringBasedArangoQuery(namedQuery, queryMethod, operations); } else if (queryMethod.hasAnnotatedQuery()) { return new StringBasedArangoQuery(queryMethod, operations); } else { return new DerivedArangoQuery(queryMethod, operations); } }
Example 4
Source File: SolrRepositoryFactory.java From dubbox with Apache License 2.0 | 6 votes |
@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); } }
Example 5
Source File: SpannerQueryLookupStrategy.java From spring-cloud-gcp with Apache License 2.0 | 6 votes |
@Override public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory, NamedQueries namedQueries) { SpannerQueryMethod queryMethod = createQueryMethod(method, metadata, factory); Class<?> entityType = getEntityType(queryMethod); boolean isDml = queryMethod.getQueryAnnotation() != null && queryMethod.getQueryAnnotation().dmlStatement(); if (queryMethod.hasAnnotatedQuery()) { Query query = queryMethod.getQueryAnnotation(); return createSqlSpannerQuery(entityType, queryMethod, query.value(), isDml); } else if (namedQueries.hasQuery(queryMethod.getNamedQueryName())) { String sql = namedQueries.getQuery(queryMethod.getNamedQueryName()); return createSqlSpannerQuery(entityType, queryMethod, sql, isDml); } return createPartTreeSpannerQuery(entityType, queryMethod); }
Example 6
Source File: EbeanQueryLookupStrategy.java From spring-data-ebean with Apache License 2.0 | 6 votes |
@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)); }