org.hibernate.loader.custom.CustomLoader Java Examples

The following examples show how to use org.hibernate.loader.custom.CustomLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SessionImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
	public ScrollableResultsImplementor scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) {
		checkOpenOrWaitingForAutoClose();
//		checkTransactionSynchStatus();

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

		CustomLoader loader = getFactory().getQueryPlanCache().getNativeQueryInterpreter().createCustomLoader( 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--;
		}
	}
 
Example #2
Source File: SessionImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
	public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) {
		checkOpenOrWaitingForAutoClose();
//		checkTransactionSynchStatus();

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

		CustomLoader loader = getFactory().getQueryPlanCache().getNativeQueryInterpreter().createCustomLoader( 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 );
		}
	}
 
Example #3
Source File: StatelessSessionImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
		throws HibernateException {
	checkOpen();
	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;
}
 
Example #4
Source File: SessionImpl.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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--;
	}
}
 
Example #5
Source File: SessionImpl.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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);
	}
}
 
Example #6
Source File: StatelessSessionImpl.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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;
}
 
Example #7
Source File: StatelessSessionImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ScrollableResultsImplementor scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
		throws HibernateException {
	checkOpen();
	CustomLoader loader = new CustomLoader( customQuery, getFactory() );
	return loader.scroll( queryParameters, this );
}
 
Example #8
Source File: StatelessSessionImpl.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException {
	errorIfClosed();
	CustomLoader loader = new CustomLoader( customQuery, getFactory() );
	return loader.scroll(queryParameters, this);
}
 
Example #9
Source File: NativeQueryInterpreter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link CustomLoader} for the given {@link CustomQuery}.
 *
 * @param customQuery The CustomQuery to create a loader for
 * @param sessionFactory The current session factory
 *
 * @deprecated This method will be removed in 6.
 */
@Deprecated
default CustomLoader createCustomLoader(CustomQuery customQuery, SessionFactoryImplementor sessionFactory) {
	return new CustomLoader( customQuery, sessionFactory );
}