Java 类org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification 实例源码

项目:lams    文件:SessionImpl.java   
@Override
public int executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification,
        QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    checkTransactionSynchStatus();
    queryParameters.validateParameters();
    NativeSQLQueryPlan plan = getNativeSQLQueryPlan( nativeQuerySpecification );


    autoFlushIfRequired( plan.getCustomQuery().getQuerySpaces() );

    boolean success = false;
    int result = 0;
    try {
        result = plan.performExecuteUpdate(queryParameters, this);
        success = true;
    } finally {
        afterOperation(success);
        delayedAfterCompletion();
    }
    return result;
}
项目:lams    文件:SQLQueryImpl.java   
public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException {
    verifyParameters();
    before();

    Map namedParams = getNamedParams();
    NativeSQLQuerySpecification spec = generateQuerySpecification( namedParams );

    QueryParameters qp = getQueryParameters( namedParams );
    qp.setScrollMode( scrollMode );

    try {
        return getSession().scroll( spec, qp );
    }
    finally {
        after();
    }
}
项目:lams    文件:StatelessSessionImpl.java   
@Override
public int executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification,
        QueryParameters queryParameters) throws HibernateException {
    errorIfClosed();
    queryParameters.validateParameters();
    NativeSQLQueryPlan plan = getNativeSQLQueryPlan(nativeSQLQuerySpecification);

    boolean success = false;
    int result = 0;
    try {
        result = plan.performExecuteUpdate(queryParameters, this);
        success = true;
    } finally {
        afterOperation(success);
    }
    temporaryPersistenceContext.clear();
    return result;
}
项目:lams    文件:QueryPlanCache.java   
/**
 * Get the query plan for a native SQL query, creating it and caching it if not already cached
 *
 * @param spec The native SQL query specification
 *
 * @return The query plan
 *
 * @throws QueryException Indicates a problem translating the query
 * @throws MappingException Indicates a problem translating the query
 */
@SuppressWarnings("unchecked")
public NativeSQLQueryPlan getNativeSQLQueryPlan(final NativeSQLQuerySpecification spec) {
    NativeSQLQueryPlan value = (NativeSQLQueryPlan) queryPlanCache.get( spec );
    if ( value == null ) {
        LOG.tracev( "Unable to locate native-sql query plan in cache; generating ({0})", spec.getQueryString() );
        value = nativeQueryInterpreterService.createQueryPlan( spec, factory );
        queryPlanCache.putIfAbsent( spec, value );
    }
    else {
        LOG.tracev( "Located native-sql query plan in cache ({0})", spec.getQueryString() );
    }
    return value;
}
项目: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    文件:SQLQueryImpl.java   
@Override
public List list() throws HibernateException {
    verifyParameters();
    before();

    Map namedParams = getNamedParams();
    NativeSQLQuerySpecification spec = generateQuerySpecification( namedParams );

    try {
        return getSession().list( spec, getQueryParameters( namedParams ) );
    }
    finally {
        after();
    }
}
项目:lams    文件:SQLQueryImpl.java   
private NativeSQLQuerySpecification generateQuerySpecification(Map namedParams) {
    return new NativeSQLQuerySpecification(
            expandParameterLists(namedParams),
            queryReturns.toArray( new NativeSQLQueryReturn[queryReturns.size()] ),
            querySpaces
    );
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException {
    return sessionImplementor.list( spec, queryParameters );
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException {
    return sessionImplementor.scroll( spec, queryParameters );
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public int executeNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters) throws HibernateException {
    return sessionImplementor.executeNativeUpdate( specification, queryParameters );
}
项目:lams    文件:AbstractSessionImpl.java   
protected NativeSQLQueryPlan getNativeSQLQueryPlan(NativeSQLQuerySpecification spec) throws HibernateException {
    return factory.getQueryPlanCache().getNativeSQLQueryPlan( spec );
}
项目:lams    文件:AbstractSessionImpl.java   
@Override
public List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
        throws HibernateException {
    return listCustomQuery( getNativeSQLQueryPlan( spec ).getCustomQuery(), queryParameters );
}
项目:lams    文件:AbstractSessionImpl.java   
@Override
public ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
        throws HibernateException {
    return scrollCustomQuery( getNativeSQLQueryPlan( spec ).getCustomQuery(), queryParameters );
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@SuppressWarnings("rawtypes")
@Override
public List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException {
    return target.list(spec, queryParameters);
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@Override
public ScrollableResultsImplementor scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters) {
    return target.scroll(spec, queryParameters);
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@Override
public int executeNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters)
        throws HibernateException {
    return target.executeNativeUpdate(specification, queryParameters);
}
项目:lams    文件:NativeQueryInterpreter.java   
/**
 * Creates a new query plan for the specified native query.
 *
 * @param specification Describes the query to create a plan for
 * @param sessionFactory The current session factory
 *
 * @return A query plan for the specified native query.
 */
NativeSQLQueryPlan createQueryPlan(NativeSQLQuerySpecification specification, SessionFactoryImplementor sessionFactory);
项目:lams    文件:SessionImplementor.java   
/**
 * Execute a native SQL query, and return the results as a fully built list.
 *
 * @param spec The specification of the native SQL query to execute.
 * @param queryParameters The parameters by which to perform the execution.
 *
 * @return The result list.
 *
 * @throws HibernateException
 */
public List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
        throws HibernateException;
项目:lams    文件:SessionImplementor.java   
/**
 * Execute a native SQL query, and return the results as a scrollable result.
 *
 * @param spec The specification of the native SQL query to execute.
 * @param queryParameters The parameters by which to perform the execution.
 *
 * @return The resulting scrollable result.
 *
 * @throws HibernateException
 */
public ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
        throws HibernateException;
项目:lams    文件:SessionImplementor.java   
/**
 * Execute a native SQL update or delete query
 */
int executeNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters)
        throws HibernateException;