Search in sources :

Example 1 with NativeSQLQueryPlan

use of org.hibernate.engine.query.spi.NativeSQLQueryPlan in project hibernate-orm by hibernate.

the class StatelessSessionImpl method executeNativeUpdate.

@Override
public int executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification, QueryParameters queryParameters) throws HibernateException {
    checkOpen();
    queryParameters.validateParameters();
    NativeSQLQueryPlan plan = getNativeQueryPlan(nativeSQLQuerySpecification);
    boolean success = false;
    int result = 0;
    try {
        result = plan.performExecuteUpdate(queryParameters, this);
        success = true;
    } finally {
        afterOperation(success);
    }
    temporaryPersistenceContext.clear();
    return result;
}
Also used : NativeSQLQueryPlan(org.hibernate.engine.query.spi.NativeSQLQueryPlan)

Example 2 with NativeSQLQueryPlan

use of org.hibernate.engine.query.spi.NativeSQLQueryPlan in project hibernate-orm by hibernate.

the class SessionImpl method executeNativeUpdate.

@Override
public int executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification, QueryParameters queryParameters) throws HibernateException {
    checkOpenOrWaitingForAutoClose();
    checkTransactionSynchStatus();
    queryParameters.validateParameters();
    NativeSQLQueryPlan plan = getNativeQueryPlan(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;
}
Also used : NativeSQLQueryPlan(org.hibernate.engine.query.spi.NativeSQLQueryPlan)

Example 3 with NativeSQLQueryPlan

use of org.hibernate.engine.query.spi.NativeSQLQueryPlan in project hibernate-orm by hibernate.

the class NativeSQLQueryPlanEqualsTest method testNativeSQLQuerySpecEquals.

@Test
public void testNativeSQLQuerySpecEquals() {
    QueryPlanCache cache = new QueryPlanCache(sessionFactory());
    NativeSQLQuerySpecification firstSpec = createSpec();
    NativeSQLQuerySpecification secondSpec = createSpec();
    NativeSQLQueryPlan firstPlan = cache.getNativeSQLQueryPlan(firstSpec);
    NativeSQLQueryPlan secondPlan = cache.getNativeSQLQueryPlan(secondSpec);
    assertEquals(firstPlan, secondPlan);
}
Also used : QueryPlanCache(org.hibernate.engine.query.spi.QueryPlanCache) NativeSQLQueryPlan(org.hibernate.engine.query.spi.NativeSQLQueryPlan) NativeSQLQuerySpecification(org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification) Test(org.junit.Test)

Aggregations

NativeSQLQueryPlan (org.hibernate.engine.query.spi.NativeSQLQueryPlan)3 QueryPlanCache (org.hibernate.engine.query.spi.QueryPlanCache)1 NativeSQLQuerySpecification (org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification)1 Test (org.junit.Test)1