List of usage examples for org.hibernate.internal CriteriaImpl setSession
public void setSession(SharedSessionContractImplementor session)
From source file:org.candlepin.model.DetachedCandlepinQuery.java
License:Open Source License
/** * Retreives an executable criteria and configures it to be ready to run the criteria with the * configuration set by this criteria instance. * * @return/*from w ww . j a v a2 s . c o m*/ * a fully configured, executable criteria */ protected Criteria getExecutableCriteria() { // Impl/sadness note: // As of Hibernate 5.0, this does not actually result in a new criteria instance -- it just // returns its internal CriteriaImpl instance. Changes we make will be reflected between // calls. CriteriaImpl executable = (CriteriaImpl) this.criteria.getExecutableCriteria(this.session); // Restore our initial state this.copyFields(this.initialState, executable, true); // Set the session again since we just clobbered it. executable.setSession((SessionImplementor) this.session); if (this.offset > -1) { executable.setFirstResult(this.offset); } if (this.limit > -1) { executable.setMaxResults(this.limit); } if (this.lockMode != null) { executable.setLockMode(this.lockMode); } // TODO: Add read-only when we have a requirement to do so. return executable; }