Package org.hibernate.engine.query

Examples of org.hibernate.engine.query.QueryPlanCache


      );
    }

    // Caches
    settings.getRegionFactory().start( settings, properties );
    this.queryPlanCache = new QueryPlanCache( this );
    //Generators:

    identifierGenerators = new HashMap();
    Iterator classes = cfg.getClassMappings();
    while ( classes.hasNext() ) {
View Full Code Here


      );
    }

    // Caches
    settings.getRegionFactory().start( settings, properties );
    this.queryPlanCache = new QueryPlanCache( this );

    //Generators:

    identifierGenerators = new HashMap();
    Iterator classes = cfg.getClassMappings();
View Full Code Here

      );
    }

    // Caches
    settings.getRegionFactory().start( settings, properties );
    this.queryPlanCache = new QueryPlanCache( this );

    //Generators:

    identifierGenerators = new HashMap();
    Iterator classes = cfg.getClassMappings();
View Full Code Here

    return ( ( SessionImplementor ) s ).getLoadQueryInfluencers().getEnabledFilters();
  }

  public void testHqlQueryPlan() {
    Session s = openSession();
    QueryPlanCache cache = ( ( SessionImplementor ) s ).getFactory().getQueryPlanCache();
    assertTrue( getEnabledFilters( s ).isEmpty() );

    HQLQueryPlan plan1 = cache.getHQLQueryPlan( "from Person", false, getEnabledFilters( s ) );
    HQLQueryPlan plan2 = cache.getHQLQueryPlan( "from Person where name is null", false, getEnabledFilters( s ) );
    HQLQueryPlan plan3 = cache.getHQLQueryPlan( "from Person where name = :name", false, getEnabledFilters( s ) );
    HQLQueryPlan plan4 = cache.getHQLQueryPlan( "from Person where name = ?", false, getEnabledFilters( s ) );

    assertNotSame( plan1, plan2 );
    assertNotSame( plan1, plan3 );
    assertNotSame( plan1, plan4 );
    assertNotSame( plan2, plan3 );
    assertNotSame( plan2, plan4 );
    assertNotSame( plan3, plan4 );

    assertSame( plan1, cache.getHQLQueryPlan( "from Person", false, getEnabledFilters( s ) ) );
    assertSame( plan2, cache.getHQLQueryPlan( "from Person where name is null", false, getEnabledFilters( s ) ) );
    assertSame( plan3, cache.getHQLQueryPlan( "from Person where name = :name", false, getEnabledFilters( s ) ) );
    assertSame( plan4, cache.getHQLQueryPlan( "from Person where name = ?", false, getEnabledFilters( s ) ) );

    s.close();
  }
View Full Code Here

    s.close();
  }

  public void testHqlQueryPlanWithEnabledFilter() {
    Session s = openSession();
    QueryPlanCache cache = ( ( SessionImplementor ) s ).getFactory().getQueryPlanCache();

    HQLQueryPlan plan1A = cache.getHQLQueryPlan( "from Person", true, getEnabledFilters( s ) );
    HQLQueryPlan plan1B = cache.getHQLQueryPlan( "from Person", false, getEnabledFilters( s ) );

    s.enableFilter( "sex" ).setParameter( "sexCode", new Character( 'F' ) );
    HQLQueryPlan plan2A = cache.getHQLQueryPlan( "from Person", true, getEnabledFilters( s ) );
    HQLQueryPlan plan2B = cache.getHQLQueryPlan( "from Person", false, getEnabledFilters( s ) );

    s.disableFilter( "sex" );
    HQLQueryPlan plan3A = cache.getHQLQueryPlan( "from Person", true, getEnabledFilters( s ) );
    HQLQueryPlan plan3B = cache.getHQLQueryPlan( "from Person", false, getEnabledFilters( s ) );

    s.enableFilter( "sex" ).setParameter( "sexCode", new Character( 'M' ) );
    HQLQueryPlan plan4A = cache.getHQLQueryPlan( "from Person", true, getEnabledFilters( s ) );
    HQLQueryPlan plan4B = cache.getHQLQueryPlan( "from Person", false, getEnabledFilters( s ) );

    assertSame( plan1A, plan3A );
    assertSame( plan1B, plan3B );
    assertSame( plan2A, plan4A );
    assertSame( plan2B, plan4B );
View Full Code Here

  public String[] getMappings() {
    return new String[] {};
  }

  public void testNativeSQLQuerySpecEquals() {
    QueryPlanCache cache = new QueryPlanCache( sfi() );
    NativeSQLQuerySpecification firstSpec = createSpec();

    NativeSQLQuerySpecification secondSpec = createSpec();
   
    NativeSQLQueryPlan firstPlan = cache.getNativeSQLQueryPlan(firstSpec);
    NativeSQLQueryPlan secondPlan = cache.getNativeSQLQueryPlan(secondSpec);
   
    assertEquals(firstPlan, secondPlan);
   
  }
View Full Code Here

    query.setComment( "dynamic native SQL query" );
    return query;
  }

  protected HQLQueryPlan getHQLQueryPlan(String query, boolean shallow) throws HibernateException {
    QueryPlanCache queryPlanCache = factory.getQueryPlanCache();
    return queryPlanCache.getHQLQueryPlan( query, shallow, getEnabledFilters() );
  }
View Full Code Here

        LOG.debugf("Session factory constructed with filter configurations : %s", filters);
        LOG.debugf("Instantiating session factory with properties: %s", properties);

    // Caches
    settings.getRegionFactory().start( settings, properties );
    this.queryPlanCache = new QueryPlanCache( this );

    // todo : everything above here consider implementing as standard SF service.  specifically: stats, caches, types, function-reg

    class IntegratorObserver implements SessionFactoryObserver {
      private ArrayList<Integrator> integrators = new ArrayList<Integrator>();
View Full Code Here

      );
    }

    // Caches
    settings.getRegionFactory().start( settings, properties );
    this.queryPlanCache = new QueryPlanCache( this );

    //Generators:

    identifierGenerators = new HashMap();
    Iterator classes = cfg.getClassMappings();
View Full Code Here

        LOG.debugf("Session factory constructed with filter configurations : %s", filters);
        LOG.debugf("Instantiating session factory with properties: %s", properties);

    // Caches
    settings.getRegionFactory().start( settings, properties );
    this.queryPlanCache = new QueryPlanCache( this );

    //Generators:

    identifierGenerators = new HashMap();
    Iterator classes = cfg.getClassMappings();
View Full Code Here

TOP

Related Classes of org.hibernate.engine.query.QueryPlanCache

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.