use of org.hibernate.engine.query.spi.HQLQueryPlan in project hibernate-orm by hibernate.
the class AbstractProducedQuery method getQueryParameters.
public QueryParameters getQueryParameters() {
final HQLQueryPlan entityGraphHintedQueryPlan;
if (entityGraphQueryHint == null) {
entityGraphHintedQueryPlan = null;
} else {
queryParameterBindings.verifyParametersBound(false);
// todo : ideally we'd update the instance state related to queryString but that is final atm
final String expandedQuery = queryParameterBindings.expandListValuedParameters(getQueryString(), getProducer());
entityGraphHintedQueryPlan = new HQLQueryPlan(expandedQuery, false, getProducer().getLoadQueryInfluencers().getEnabledFilters(), getProducer().getFactory(), entityGraphQueryHint);
}
QueryParameters queryParameters = new QueryParameters(getPositionalParameterTypes(), getPositionalParameterValues(), getNamedParameterMap(), getLockOptions(), queryOptions, true, isReadOnly(), cacheable, cacheRegion, comment, dbHints, null, optionalObject, optionalEntityName, optionalId, resultTransformer);
queryParameters.setQueryPlan(entityGraphHintedQueryPlan);
if (passDistinctThrough != null) {
queryParameters.setPassDistinctThrough(passDistinctThrough);
}
return queryParameters;
}
use of org.hibernate.engine.query.spi.HQLQueryPlan in project hibernate-orm by hibernate.
the class TupleSupportTest method testImplicitTupleNotInList.
@Test
public void testImplicitTupleNotInList() {
final String hql = "from TheEntity e where e.compositeValue not in (:p1,:p2)";
HQLQueryPlan queryPlan = ((SessionFactoryImplementor) sessionFactory).getQueryPlanCache().getHQLQueryPlan(hql, false, Collections.<String, Filter>emptyMap());
assertEquals(1, queryPlan.getSqlStrings().length);
System.out.println(" SQL : " + queryPlan.getSqlStrings()[0]);
assertTrue(queryPlan.getSqlStrings()[0].contains("<>"));
}
use of org.hibernate.engine.query.spi.HQLQueryPlan in project hibernate-orm by hibernate.
the class StatelessSessionImpl method scroll.
@Override
public ScrollableResultsImplementor scroll(String query, QueryParameters queryParameters) throws HibernateException {
checkOpen();
HQLQueryPlan plan = getQueryPlan(query, false);
return plan.performScroll(queryParameters, this);
}
use of org.hibernate.engine.query.spi.HQLQueryPlan in project hibernate-orm by hibernate.
the class StatelessSessionImpl method list.
/////////////////////////////////////////////////////////////////////////////////////////////////////
//TODO: COPY/PASTE FROM SessionImpl, pull up!
@Override
public List list(String query, QueryParameters queryParameters) throws HibernateException {
checkOpen();
queryParameters.validateParameters();
HQLQueryPlan plan = getQueryPlan(query, false);
boolean success = false;
List results = Collections.EMPTY_LIST;
try {
results = plan.performList(queryParameters, this);
success = true;
} finally {
afterOperation(success);
}
temporaryPersistenceContext.clear();
return results;
}
use of org.hibernate.engine.query.spi.HQLQueryPlan in project hibernate-orm by hibernate.
the class SessionImpl method iterate.
@Override
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException {
checkOpenOrWaitingForAutoClose();
checkTransactionSynchStatus();
queryParameters.validateParameters();
HQLQueryPlan plan = queryParameters.getQueryPlan();
if (plan == null) {
plan = getQueryPlan(query, true);
}
autoFlushIfRequired(plan.getQuerySpaces());
//stops flush being called multiple times if this method is recursively called
dontFlushFromFind++;
try {
return plan.performIterate(queryParameters, this);
} finally {
delayedAfterCompletion();
dontFlushFromFind--;
}
}
Aggregations