Java 类org.hibernate.loader.custom.CustomQuery 实例源码

项目:lams    文件:SessionImpl.java   
@Override
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();

    if ( LOG.isTraceEnabled() ) {
        LOG.tracev( "Scroll SQL query: {0}", customQuery.getSQL() );
    }

    CustomLoader loader = new CustomLoader( customQuery, getFactory() );

    autoFlushIfRequired( loader.getQuerySpaces() );

    dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
    try {
        return loader.scroll(queryParameters, this);
    }
    finally {
        delayedAfterCompletion();
        dontFlushFromFind--;
    }
}
项目:lams    文件:StatelessSessionImpl.java   
@Override
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException {
    errorIfClosed();
    CustomLoader loader = new CustomLoader( customQuery, getFactory() );

    boolean success = false;
    List results;
    try {
        results = loader.list(this, queryParameters);
        success = true;
    }
    finally {
        afterOperation(success);
    }
    temporaryPersistenceContext.clear();
    return results;
}
项目:cacheonix-core    文件:SessionImpl.java   
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) 
throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();

    if ( log.isTraceEnabled() ) {
        log.trace( "scroll SQL query: " + customQuery.getSQL() );
    }

    CustomLoader loader = new CustomLoader( customQuery, getFactory() );

    autoFlushIfRequired( loader.getQuerySpaces() );

    dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
    try {
        return loader.scroll(queryParameters, this);
    }
    finally {
        dontFlushFromFind--;
    }
}
项目:cacheonix-core    文件:SessionImpl.java   
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) 
throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();

    if ( log.isTraceEnabled() ) {
        log.trace( "SQL query: " + customQuery.getSQL() );
    }

    CustomLoader loader = new CustomLoader( customQuery, getFactory() );

    autoFlushIfRequired( loader.getQuerySpaces() );

    dontFlushFromFind++;
    boolean success = false;
    try {
        List results = loader.list(this, queryParameters);
        success = true;
        return results;
    }
    finally {
        dontFlushFromFind--;
        afterOperation(success);
    }
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException {
    errorIfClosed();
    CustomLoader loader = new CustomLoader( customQuery, getFactory() );

    boolean success = false;
    List results;
    try {
        results = loader.list(this, queryParameters);
        success = true;
    }
    finally {
        afterOperation(success);
    }
    temporaryPersistenceContext.clear();
    return results;
}
项目:lams    文件:NativeQueryInterpreterStandardImpl.java   
@Override
public NativeSQLQueryPlan createQueryPlan(
        NativeSQLQuerySpecification specification,
        SessionFactoryImplementor sessionFactory) {

    CustomQuery customQuery = new SQLCustomQuery(
            specification.getQueryString(),
            specification.getQueryReturns(),
            specification.getQuerySpaces(),
            sessionFactory
    );

    return new NativeSQLQueryPlan( specification.getQueryString(), customQuery );
}
项目:lams    文件:SessionImpl.java   
@Override
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();

    if ( LOG.isTraceEnabled() ) {
        LOG.tracev( "SQL query: {0}", customQuery.getSQL() );
    }

    CustomLoader loader = new CustomLoader( customQuery, getFactory() );

    autoFlushIfRequired( loader.getQuerySpaces() );

    dontFlushFromFind++;
    boolean success = false;
    try {
        List results = loader.list(this, queryParameters);
        success = true;
        return results;
    }
    finally {
        dontFlushFromFind--;
        delayedAfterCompletion();
        afterOperation(success);
    }
}
项目:lams    文件:StatelessSessionImpl.java   
@Override
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException {
    errorIfClosed();
    CustomLoader loader = new CustomLoader( customQuery, getFactory() );
    return loader.scroll( queryParameters, this );
}
项目:lams    文件:OutputsImpl.java   
private static CustomLoaderExtension buildSpecializedCustomLoader(final ResultContext context) {
    // might be better to just manually construct the Return(s).. SQLQueryReturnProcessor does a lot of
    // work that is really unnecessary here.
    final SQLQueryReturnProcessor processor = new SQLQueryReturnProcessor(
            context.getQueryReturns(),
            context.getSession().getFactory()
    );
    processor.process();
    final List<org.hibernate.loader.custom.Return> customReturns = processor.generateCustomReturns( false );

    CustomQuery customQuery = new CustomQuery() {
        @Override
        public String getSQL() {
            return context.getSql();
        }

        @Override
        public Set<String> getQuerySpaces() {
            return context.getSynchronizedQuerySpaces();
        }

        @Override
        public Map getNamedParameterBindPoints() {
            // no named parameters in terms of embedded in the SQL string
            return null;
        }

        @Override
        public List<org.hibernate.loader.custom.Return> getCustomQueryReturns() {
            return customReturns;
        }
    };

    return new CustomLoaderExtension(
            customQuery,
            context.getQueryParameters(),
            context.getSession()
    );
}
项目:lams    文件:OutputsImpl.java   
public CustomLoaderExtension(
        CustomQuery customQuery,
        QueryParameters queryParameters,
        SessionImplementor session) {
    super( customQuery, session.getFactory() );
    this.queryParameters = queryParameters;
    this.session = session;
}
项目:lams    文件:NativeSQLQueryPlan.java   
public CustomQuery getCustomQuery() {
    return customQuery;
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException {
    return sessionImplementor.listCustomQuery( customQuery, queryParameters );
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException {
    return sessionImplementor.scrollCustomQuery( customQuery, queryParameters );
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException {
    errorIfClosed();
    CustomLoader loader = new CustomLoader( customQuery, getFactory() );
    return loader.scroll(queryParameters, this);
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@SuppressWarnings("rawtypes")
@Override
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException {
    return target.listCustomQuery(customQuery, queryParameters);
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@Override
public ScrollableResultsImplementor scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
        throws HibernateException {
    return target.scrollCustomQuery(customQuery, queryParameters);
}
项目:lams    文件:NativeSQLQueryPlan.java   
/**
  * Constructs a NativeSQLQueryPlan.
  *
  * @param sourceQuery The original native query to create a plan for
  * @param customQuery The query executed via this plan
  */
public NativeSQLQueryPlan(String sourceQuery, CustomQuery customQuery) {
    this.sourceQuery = sourceQuery;
    this.customQuery = customQuery;
}
项目:lams    文件:SessionImplementor.java   
/**
 * Execute an SQL Query
 */
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
        throws HibernateException;
项目:lams    文件:SessionImplementor.java   
/**
 * Execute an SQL Query
 */
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
        throws HibernateException;
项目:cacheonix-core    文件:SessionImplementor.java   
/**
 * Execute an SQL Query
 */
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) 
throws HibernateException;
项目:cacheonix-core    文件:SessionImplementor.java   
/**
 * Execute an SQL Query
 */
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) 
throws HibernateException;