Java 类org.hibernate.engine.query.HQLQueryPlan 实例源码

项目:cacheonix-core    文件:SessionImpl.java   
public List list(String query, QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();
    queryParameters.validateParameters();
    HQLQueryPlan plan = getHQLQueryPlan( query, false );
    autoFlushIfRequired( plan.getQuerySpaces() );

    List results = CollectionHelper.EMPTY_LIST;
    boolean success = false;

    dontFlushFromFind++;   //stops flush being called multiple times if this method is recursively called
    try {
        results = plan.performList( queryParameters, this );
        success = true;
    }
    finally {
        dontFlushFromFind--;
        afterOperation(success);
    }
    return results;
}
项目:cacheonix-core    文件:SessionImpl.java   
public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();
    queryParameters.validateParameters();
    HQLQueryPlan plan = getHQLQueryPlan( query, false );
    autoFlushIfRequired( plan.getQuerySpaces() );

    boolean success = false;
    int result = 0;
    try {
        result = plan.performExecuteUpdate( queryParameters, this );
        success = true;
    }
    finally {
        afterOperation(success);
    }
    return result;
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public int executeUpdate(String query, QueryParameters queryParameters)
        throws HibernateException {
    errorIfClosed();
    queryParameters.validateParameters();
    HQLQueryPlan plan = getHQLQueryPlan( query, false );
    boolean success = false;
    int result = 0;
    try {
        result = plan.performExecuteUpdate( queryParameters, this );
        success = true;
    }
    finally {
        afterOperation(success);
    }
    temporaryPersistenceContext.clear();
    return result;
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public List list(String query, QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    queryParameters.validateParameters();
    HQLQueryPlan plan = getHQLQueryPlan( query, false );
    boolean success = false;
    List results = CollectionHelper.EMPTY_LIST;
    try {
        results = plan.performList( queryParameters, this );
        success = true;
    }
    finally {
        afterOperation(success);
    }
    temporaryPersistenceContext.clear();
    return results;
}
项目:cacheonix-core    文件:SessionImpl.java   
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();
    queryParameters.validateParameters();
    HQLQueryPlan plan = getHQLQueryPlan( query, true );
    autoFlushIfRequired( plan.getQuerySpaces() );

    dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
    try {
        return plan.performIterate( queryParameters, this );
    }
    finally {
        dontFlushFromFind--;
    }
}
项目:cacheonix-core    文件:SessionImpl.java   
public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();
    HQLQueryPlan plan = getHQLQueryPlan( query, false );
    autoFlushIfRequired( plan.getQuerySpaces() );
    dontFlushFromFind++;
    try {
        return plan.performScroll( queryParameters, this );
    }
    finally {
        dontFlushFromFind--;
    }
}
项目:cacheonix-core    文件:HQLTest.java   
public void testReturnMetadata() {
    HQLQueryPlan plan = createQueryPlan( "from Animal a" );
    check( plan.getReturnMetadata(), false, true );

    plan = createQueryPlan( "select a as animal from Animal a" );
    check( plan.getReturnMetadata(), false, false );

    plan = createQueryPlan( "from java.lang.Object" );
    check( plan.getReturnMetadata(), true, true );

    plan = createQueryPlan( "select o as entity from java.lang.Object o" );
    check( plan.getReturnMetadata(), true, false );
}
项目:cacheonix-core    文件:AbstractSessionImpl.java   
protected HQLQueryPlan getHQLQueryPlan(String query, boolean shallow) throws HibernateException {
    return factory.getQueryPlanCache().getHQLQueryPlan( query, shallow, getEnabledFilters() );
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    HQLQueryPlan plan = getHQLQueryPlan( query, false );
    return plan.performScroll( queryParameters, this );
}
项目:cacheonix-core    文件:QueryTranslatorTestCase.java   
protected HQLQueryPlan createQueryPlan(String hql, boolean scalar) {
    return new HQLQueryPlan( hql, scalar, Collections.EMPTY_MAP, getSessionFactoryImplementor() );
}
项目:cacheonix-core    文件:QueryTranslatorTestCase.java   
protected HQLQueryPlan createQueryPlan(String hql) {
    return createQueryPlan( hql, false );
}