Search in sources :

Example 1 with JDOQueryInterruptedException

use of javax.jdo.JDOQueryInterruptedException in project datanucleus-api-jdo by datanucleus.

the class JDOQuery method deletePersistentInternal.

protected long deletePersistentInternal() {
    try {
        if (parameterValues != null) {
            return query.deletePersistentAll(parameterValues);
        } else if (parameterValueByName != null) {
            return query.deletePersistentAll(parameterValueByName);
        }
        return query.deletePersistentAll();
    } catch (NoQueryResultsException nqre) {
        return 0;
    } catch (QueryTimeoutException qte) {
        throw new JDODataStoreException("Query has timed out : " + qte.getMessage());
    } catch (QueryInterruptedException qie) {
        throw new JDOQueryInterruptedException("Query has been cancelled : " + qie.getMessage());
    } catch (NucleusException jpe) {
        throw NucleusJDOHelper.getJDOExceptionForNucleusException(jpe);
    } finally {
        // Parameter values are not retained beyond subsequent execute/deletePersistentAll
        this.parameterValueByName = null;
        this.parameterValues = null;
    }
}
Also used : QueryTimeoutException(org.datanucleus.store.query.QueryTimeoutException) NucleusException(org.datanucleus.exceptions.NucleusException) NoQueryResultsException(org.datanucleus.store.query.NoQueryResultsException) JDODataStoreException(javax.jdo.JDODataStoreException) QueryInterruptedException(org.datanucleus.store.query.QueryInterruptedException) JDOQueryInterruptedException(javax.jdo.JDOQueryInterruptedException) JDOQueryInterruptedException(javax.jdo.JDOQueryInterruptedException)

Example 2 with JDOQueryInterruptedException

use of javax.jdo.JDOQueryInterruptedException in project datanucleus-api-jdo by datanucleus.

the class JDOQuery method executeInternal.

protected Object executeInternal() {
    try {
        if (parameterValues != null) {
            return query.executeWithArray(parameterValues);
        } else if (parameterValueByName != null) {
            return query.executeWithMap(parameterValueByName);
        }
        return query.execute();
    } catch (NoQueryResultsException nqre) {
        return null;
    } catch (QueryTimeoutException qte) {
        throw new JDODataStoreException("Query has timed out : " + qte.getMessage());
    } catch (QueryInterruptedException qie) {
        throw new JDOQueryInterruptedException("Query has been cancelled : " + qie.getMessage());
    } catch (NucleusException jpe) {
        // Convert any exceptions into what JDO expects
        throw NucleusJDOHelper.getJDOExceptionForNucleusException(jpe);
    } finally {
        // Parameter values are not retained beyond subsequent execute/deletePersistentAll
        this.parameterValueByName = null;
        this.parameterValues = null;
    }
}
Also used : QueryTimeoutException(org.datanucleus.store.query.QueryTimeoutException) NucleusException(org.datanucleus.exceptions.NucleusException) NoQueryResultsException(org.datanucleus.store.query.NoQueryResultsException) JDODataStoreException(javax.jdo.JDODataStoreException) QueryInterruptedException(org.datanucleus.store.query.QueryInterruptedException) JDOQueryInterruptedException(javax.jdo.JDOQueryInterruptedException) JDOQueryInterruptedException(javax.jdo.JDOQueryInterruptedException)

Aggregations

JDODataStoreException (javax.jdo.JDODataStoreException)2 JDOQueryInterruptedException (javax.jdo.JDOQueryInterruptedException)2 NucleusException (org.datanucleus.exceptions.NucleusException)2 NoQueryResultsException (org.datanucleus.store.query.NoQueryResultsException)2 QueryInterruptedException (org.datanucleus.store.query.QueryInterruptedException)2 QueryTimeoutException (org.datanucleus.store.query.QueryTimeoutException)2