public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException { if ( log.isTraceEnabled() ) { log.trace( "executeUpdate: " + query ); queryParameters.traceParameters(factory); } queryParameters.validateParameters(); QueryTranslator[] queryTranslators = getQueries(query, false); int result = 0; boolean success = false; try { for (int i=0; i<queryTranslators.length; i++) { result += queryTranslators[i].executeUpdate( queryParameters, this ); } success = true; } finally { afterOperation(success); } return result; }
public List list(String query, QueryParameters queryParameters) throws HibernateException { if ( log.isTraceEnabled() ) { log.trace( "find: " + query ); queryParameters.traceParameters(factory); } queryParameters.validateParameters(); QueryTranslator[] q = getQueries(query, false); List results = CollectionHelper.EMPTY_LIST; dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called //execute the queries and return all result lists as a single list boolean success = false; try { for ( int i = 0; i < q.length; i++ ) { List currentResults = q[i].list(this, queryParameters); currentResults.addAll(results); results = currentResults; } success = true; } finally { dontFlushFromFind--; afterOperation(success); } return results; }
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException { if ( log.isTraceEnabled() ) { log.trace( "iterate: " + query ); queryParameters.traceParameters(factory); } queryParameters.validateParameters(); QueryTranslator[] q = getQueries(query, true); if ( q.length == 0 ) return EmptyIterator.INSTANCE; Iterator result = null; Iterator[] results = null; boolean many = q.length > 1; if (many) results = new Iterator[q.length]; dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called try { //execute the queries and return all results as a single iterator for ( int i = 0; i < q.length; i++ ) { result = q[i].iterate(queryParameters, this); if (many) results[i] = result; } return many ? new JoinedIterator(results) : result; } finally { dontFlushFromFind--; } }
public List list(String query, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); queryParameters.validateParameters(); HQLQueryPlan plan = getHQLQueryPlan( query, false ); boolean success = false; List results = CollectionHelper.EMPTY_LIST; try { results = plan.performList( queryParameters, this ); success = true; } finally { afterOperation(success); } temporaryPersistenceContext.clear(); return results; }
public int executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); queryParameters.validateParameters(); NativeSQLQueryPlan plan = getNativeSQLQueryPlan(nativeSQLQuerySpecification); boolean success = false; int result = 0; try { result = plan.performExecuteUpdate(queryParameters, this); success = true; } finally { afterOperation(success); } temporaryPersistenceContext.clear(); return result; }
public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); queryParameters.validateParameters(); HQLQueryPlan plan = getHQLQueryPlan( query, false ); boolean success = false; int result = 0; try { result = plan.performExecuteUpdate( queryParameters, this ); success = true; } finally { afterOperation(success); } temporaryPersistenceContext.clear(); return result; }
public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); checkTransactionSynchStatus(); queryParameters.validateParameters(); HQLQueryPlan plan = getHQLQueryPlan( query, false ); autoFlushIfRequired( plan.getQuerySpaces() ); boolean success = false; int result = 0; try { result = plan.performExecuteUpdate( queryParameters, this ); success = true; } finally { afterOperation(success); } return result; }
public List list(String query, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); checkTransactionSynchStatus(); queryParameters.validateParameters(); HQLQueryPlan plan = getHQLQueryPlan( query, false ); autoFlushIfRequired( plan.getQuerySpaces() ); List results = CollectionHelper.EMPTY_LIST; boolean success = false; dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called try { results = plan.performList( queryParameters, this ); success = true; } finally { dontFlushFromFind--; afterOperation(success); } return results; }
public int executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); checkTransactionSynchStatus(); queryParameters.validateParameters(); NativeSQLQueryPlan plan = getNativeSQLQueryPlan(nativeQuerySpecification); autoFlushIfRequired( plan.getCustomQuery().getQuerySpaces() ); boolean success = false; int result = 0; try { result = plan.performExecuteUpdate(queryParameters, this); success = true; } finally { afterOperation(success); } return result; }
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); checkTransactionSynchStatus(); queryParameters.validateParameters(); HQLQueryPlan plan = getHQLQueryPlan( query, true ); autoFlushIfRequired( plan.getQuerySpaces() ); dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called try { return plan.performIterate( queryParameters, this ); } finally { dontFlushFromFind--; } }