Package org.hibernate.hql.ast.spi

Examples of org.hibernate.hql.ast.spi.EntityNamesResolver


  public boolean supportsParameters() {
    return false;
  }

  private MongoDBProcessingChain createProcessingChain(SessionFactoryImplementor sessionFactory, Map<String, Object> namedParameters) {
    EntityNamesResolver entityNamesResolver = getDefinedEntityNames( sessionFactory );

    return new MongoDBProcessingChain(
        sessionFactory,
        entityNamesResolver,
        namedParameters );
View Full Code Here


  private MongoDBProcessingChain setUpMongoDbProcessingChain(Map<String, Object> namedParameters) {
    Map<String, Class<?>> entityNames = new HashMap<String, Class<?>>();
    entityNames.put( "com.acme.IndexedEntity", IndexedEntity.class );
    entityNames.put( "IndexedEntity", IndexedEntity.class );
    EntityNamesResolver nameResolver = new MapBasedEntityNamesResolver( entityNames );

    return new MongoDBProcessingChain( sessions, nameResolver, namedParameters );
  }
View Full Code Here

   private byte[] executeQuery(AdvancedCache<byte[], byte[]> cache, byte[] query) throws IOException {
      final SerializationContext serCtx = SerializationContextHolder.getSerializationContext();

      QueryRequest request = ProtobufUtil.fromByteArray(serCtx, query, 0, query.length, QueryRequest.class);

      EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
         @Override
         public Class<?> getClassFromName(String entityName) {
            try {
               //todo [anistor] this just checks if the type is known
               serCtx.getMessageDescriptor(entityName);
View Full Code Here

      this.queryInterceptor = ComponentRegistryUtils.getQueryInterceptor(cache);
   }

   @Override
   public QueryFactory getQueryFactory() {
      EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
         @Override
         public Class<?> getClassFromName(String entityName) {
            Class clazz;
            try {
               clazz = Class.forName(entityName);
View Full Code Here

      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);
View Full Code Here

    return new MongoDBQueryImpl( result.getEntityType(), result.getQuery(), result.getProjection(), session );
  }

  private MongoDBProcessingChain createProcessingChain(Session session, Map<String, Object> namedParameters) {
    EntityNamesResolver entityNamesResolver = getDefinedEntityNames( session.getSessionFactory() );

    return new MongoDBProcessingChain(
        (SessionFactoryImplementor) session.getSessionFactory(),
        entityNamesResolver,
        namedParameters );
View Full Code Here

      this.queryInterceptor = ComponentRegistryUtils.getQueryInterceptor(cache);
   }

   @Override
   public QueryFactory getQueryFactory() {
      EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
         @Override
         public Class<?> getClassFromName(String entityName) {
            Class clazz;
            try {
               clazz = Class.forName(entityName);
View Full Code Here

    return query;
  }

  private MongoDBProcessingChain createProcessingChain(Session session, Map<String, Object> namedParameters) {
    EntityNamesResolver entityNamesResolver = getDefinedEntityNames( session.getSessionFactory() );

    return new MongoDBProcessingChain(
        (SessionFactoryImplementor) session.getSessionFactory(),
        entityNamesResolver,
        namedParameters );
View Full Code Here

   private LuceneQueryParsingResult parseQuery(AdvancedCache<byte[], byte[]> cache, final SerializationContext serCtx, String queryString, SearchFactoryIntegrator searchFactory) {
      LuceneProcessingChain processingChain;
      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();
               return queryInterceptor.isIndexed(clazz) ? clazz : null;
            }
         };

         processingChain = new LuceneProcessingChain.Builder(searchFactory, entityNamesResolver)
               .buildProcessingChainForClassBasedEntities();
      } else {
         EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
            @Override
            public Class<?> getClassFromName(String entityName) {
               return serCtx.canMarshall(entityName) ? ProtobufValueWrapper.class : null;
            }
         };
View Full Code Here

      this.queryInterceptor = ComponentRegistryUtils.getQueryInterceptor(cache);
   }

   @Override
   public QueryFactory<LuceneQuery> getQueryFactory() {
      EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
         @Override
         public Class<?> getClassFromName(String entityName) {
            Class clazz;
            try {
               clazz = Class.forName(entityName)//todo [anistor] any potential class loading issues in AS ?
View Full Code Here

TOP

Related Classes of org.hibernate.hql.ast.spi.EntityNamesResolver

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.