Package org.hibernate.hql

Examples of org.hibernate.hql.QueryParser


  private volatile SessionFactoryEntityNamesResolver entityNamesResolver;

  @Override
  public QueryParsingResult parseQuery(SessionFactoryImplementor sessionFactory, String queryString, Map<String, Object> namedParameters) {
    QueryParser queryParser = new QueryParser();
    MongoDBProcessingChain processingChain = createProcessingChain( sessionFactory, unwrap( namedParameters ) );

    MongoDBQueryParsingResult result = queryParser.parseQuery( queryString, processingChain );
    log.createdQuery( queryString, result );

    return result;
  }
View Full Code Here


  private QueryParser queryParser;

  @Before
  public void setupParser() {
    queryParser = new QueryParser();
  }
View Full Code Here

  private LuceneQueryParsingResult getLuceneQuery(QueryParameters queryParameters, FullTextSession fullTextSession) {
    CacheKey cacheKey = new CacheKey( queryParameters.getNamedParameters() );
    LuceneQueryParsingResult parsingResult = luceneQueryCache.get( cacheKey );

    if ( parsingResult == null ) {
      parsingResult = new QueryParser().parseQuery(
          getQueryString(),
          createProcessingChain( getNamedParameterValues( queryParameters ), fullTextSession )
      );

      LuceneQueryParsingResult cached = luceneQueryCache.putIfAbsent( cacheKey, parsingResult );
View Full Code Here

         }
      };

      SearchManager searchManager = Search.getSearchManager(cache);
      IspnLuceneProcessingChain processingChain = new IspnLuceneProcessingChain((SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null);
      QueryParser queryParser = new QueryParser();
      IspnLuceneQueryParsingResult parsingResult = queryParser.parseQuery(request.getJpqlString(), processingChain);

      Sort sort = null;
      if (request.getSortCriteria() != null && !request.getSortCriteria().isEmpty()) {
         SortField[] sortField = new SortField[request.getSortCriteria().size()];
         int i = 0;
View Full Code Here

      Query luceneQuery;
      List<String> projections;
      Class targetEntity;
      Descriptors.Descriptor messageDescriptor;

      QueryParser queryParser = new QueryParser();
      if (cache.getCacheConfiguration().compatibility().enabled()) {
         final QueryInterceptor queryInterceptor = ComponentRegistryUtils.getQueryInterceptor(cache);
         EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
            @Override
            public Class<?> getClassFromName(String entityName) {
               MessageMarshaller messageMarshaller = (MessageMarshaller) serCtx.getMarshaller(entityName);
               Class clazz = messageMarshaller.getJavaClass();
               Boolean isIndexed = queryInterceptor.getKnownClasses().get(clazz);
               return isIndexed != null && isIndexed ? clazz : null;
            }
         };

         LuceneProcessingChain processingChain = new LuceneProcessingChain((SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null);
         LuceneQueryParsingResult parsingResult = queryParser.parseQuery(request.getJpqlString(), processingChain);

         MessageMarshaller messageMarshaller = (MessageMarshaller) serCtx.getMarshaller(parsingResult.getTargetEntity());
         messageDescriptor = serCtx.getMessageDescriptor(messageMarshaller.getTypeName());
         targetEntity = parsingResult.getTargetEntity();
         projections = parsingResult.getProjections();
         luceneQuery = parsingResult.getQuery();
      } else {
         EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
            @Override
            public Class<?> getClassFromName(String entityName) {
               try {
                  //todo [anistor] this just checks if the type is known
                  serCtx.getMessageDescriptor(entityName);
               } catch (Exception e) {
                  return null;
               }
               return ProtobufValueWrapper.class;
            }
         };

         IspnLuceneProcessingChain processingChain = new IspnLuceneProcessingChain(serCtx, (SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null);
         IspnLuceneQueryParsingResult parsingResult = queryParser.parseQuery(request.getJpqlString(), processingChain);
         messageDescriptor = parsingResult.getTargetType();
         targetEntity = parsingResult.getTargetEntity();
         projections = parsingResult.getProjections();

         QueryBuilder qb = searchManager.getSearchFactory().buildQueryBuilder().forEntity(targetEntity).get();
View Full Code Here

  private volatile SessionFactoryEntityNamesResolver entityNamesResolver;

  @Override
  public Query getParsedQueryExecutor(OgmSession session, String queryString, Map<String, Object> namedParameters) {
    QueryParser queryParser = new QueryParser();
    MongoDBProcessingChain processingChain = createProcessingChain( session, unwrap( namedParameters ) );

    MongoDBQueryParsingResult result = queryParser.parseQuery( queryString, processingChain );
    log.createdQuery( queryString, result );

    return new MongoDBQueryImpl( result.getEntityType(), result.getQuery(), result.getProjection(), session );
  }
View Full Code Here

      if (log.isTraceEnabled()) {
         log.tracef("JPQL string : %s", jpqlString);
      }

      LuceneProcessingChain processingChain = new LuceneProcessingChain((SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null);
      QueryParser queryParser = new QueryParser();
      LuceneQueryParsingResult parsingResult = queryParser.parseQuery(jpqlString, processingChain);

      Sort sort = null;
      if (sortCriteria != null && !sortCriteria.isEmpty()) {
         SortField[] sortField = new SortField[sortCriteria.size()];
         int i = 0;
View Full Code Here

  private volatile SessionFactoryEntityNamesResolver entityNamesResolver;

  @Override
  public Query getParsedQueryExecutor(OgmSession session, String queryString, Map<String, Object> namedParameters) {
    QueryParser queryParser = new QueryParser();
    MongoDBProcessingChain processingChain = createProcessingChain( session, unwrap( namedParameters ) );

    MongoDBQueryParsingResult result = queryParser.parseQuery( queryString, processingChain );
    log.createdQuery( queryString, result );

    SessionImplementor sessionImplementor = (SessionImplementor) session;

    String tableName = ( (OgmEntityPersister) ( sessionImplementor
View Full Code Here

         processingChain = new LuceneProcessingChain.Builder(searchFactory, entityNamesResolver)
               .buildProcessingChainForDynamicEntities(fieldBridgeProvider);
      }

      return new QueryParser().parseQuery(queryString, processingChain);
   }
View Full Code Here

         log.tracef("JPQL string : %s", jpqlString);
      }

      SearchFactoryIntegrator searchFactory = (SearchFactoryIntegrator) searchManager.getSearchFactory();
      LuceneProcessingChain processingChain = new LuceneProcessingChain.Builder(searchFactory, entityNamesResolver).buildProcessingChainForClassBasedEntities();
      QueryParser queryParser = new QueryParser();
      LuceneQueryParsingResult parsingResult = queryParser.parseQuery(jpqlString, processingChain);

      return new EmbeddedLuceneQuery(searchManager, parsingResult, startOffset, maxResults);
   }
View Full Code Here

TOP

Related Classes of org.hibernate.hql.QueryParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.