@Override public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); checkTransactionSynchStatus(); if ( LOG.isTraceEnabled() ) { LOG.tracev( "Scroll SQL query: {0}", 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 { delayedAfterCompletion(); dontFlushFromFind--; } }
@Override 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; }
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--; } }
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); } }
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; }
@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 ); }
@Override public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); checkTransactionSynchStatus(); if ( LOG.isTraceEnabled() ) { LOG.tracev( "SQL query: {0}", 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--; delayedAfterCompletion(); afterOperation(success); } }
@Override public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); CustomLoader loader = new CustomLoader( customQuery, getFactory() ); return loader.scroll( queryParameters, this ); }
private static CustomLoaderExtension buildSpecializedCustomLoader(final ResultContext context) { // might be better to just manually construct the Return(s).. SQLQueryReturnProcessor does a lot of // work that is really unnecessary here. final SQLQueryReturnProcessor processor = new SQLQueryReturnProcessor( context.getQueryReturns(), context.getSession().getFactory() ); processor.process(); final List<org.hibernate.loader.custom.Return> customReturns = processor.generateCustomReturns( false ); CustomQuery customQuery = new CustomQuery() { @Override public String getSQL() { return context.getSql(); } @Override public Set<String> getQuerySpaces() { return context.getSynchronizedQuerySpaces(); } @Override public Map getNamedParameterBindPoints() { // no named parameters in terms of embedded in the SQL string return null; } @Override public List<org.hibernate.loader.custom.Return> getCustomQueryReturns() { return customReturns; } }; return new CustomLoaderExtension( customQuery, context.getQueryParameters(), context.getSession() ); }
public CustomLoaderExtension( CustomQuery customQuery, QueryParameters queryParameters, SessionImplementor session) { super( customQuery, session.getFactory() ); this.queryParameters = queryParameters; this.session = session; }
public CustomQuery getCustomQuery() { return customQuery; }
@Override public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { return sessionImplementor.listCustomQuery( customQuery, queryParameters ); }
@Override public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { return sessionImplementor.scrollCustomQuery( customQuery, queryParameters ); }
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); CustomLoader loader = new CustomLoader( customQuery, getFactory() ); return loader.scroll(queryParameters, this); }
@SuppressWarnings("rawtypes") @Override public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { return target.listCustomQuery(customQuery, queryParameters); }
@Override public ScrollableResultsImplementor scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { return target.scrollCustomQuery(customQuery, queryParameters); }
/** * Constructs a NativeSQLQueryPlan. * * @param sourceQuery The original native query to create a plan for * @param customQuery The query executed via this plan */ public NativeSQLQueryPlan(String sourceQuery, CustomQuery customQuery) { this.sourceQuery = sourceQuery; this.customQuery = customQuery; }
/** * Execute an SQL Query */ public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException;
/** * Execute an SQL Query */ public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException;