use of org.datanucleus.store.query.NoQueryResultsException 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;
}
}
use of org.datanucleus.store.query.NoQueryResultsException 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;
}
}
use of org.datanucleus.store.query.NoQueryResultsException in project datanucleus-rdbms by datanucleus.
the class StoredProcedureQuery method getNextResults.
@Override
public Object getNextResults() {
if (stmt == null) {
throw new NucleusUserException("Cannot check for more results until the stored procedure has been executed");
}
ManagedConnection mconn = storeMgr.getConnectionManager().getConnection(ec);
try {
resultSetNumber++;
ResultSet rs = stmt.getResultSet();
QueryResult qr = getResultsForResultSet((RDBMSStoreManager) storeMgr, rs, mconn);
if (shouldReturnSingleRow()) {
// Single row only needed so just take first row
try {
if (qr == null || qr.size() == 0) {
throw new NoQueryResultsException("No query results were returned");
}
Iterator qrIter = qr.iterator();
Object firstRow = qrIter.next();
if (qrIter.hasNext()) {
throw new QueryNotUniqueException();
}
return firstRow;
} finally {
// can close results right now because we don't return it
close(qr);
}
}
// Apply range?
return qr;
} catch (SQLException sqle) {
throw new NucleusDataStoreException("Exception from CallableStatement.getResultSet", sqle);
} finally {
mconn.release();
}
}
Aggregations