Interface DatabaseQueryActivity

  • public interface DatabaseQueryActivity
    The query activity on which result and failure events are fired. This activity does not support transactions.

    Asynchronous Queries

    The procedure to send asynchronous queries is:

    1. create the activity using the DatabaseQueryProvider.createActivity() method
    2. get an ActivityContextInterface object for the activity
    3. attach the SBB local object to the ACI
    4. create a QueryInfo object that contains a copy of the values to set as parameters on the statement
    5. send the query using the sendQuery(QueryInfo) method on the activity
    6. handle the result in an event handler for the DatabaseResultEvent event
    7. handle failures in an event handler for the DatabaseQueryFailureEvent event
    Example Asynchronous Query
         private void asyncRequest(String shortCode) {
             try {
                 DatabaseQueryActivity queryActivity = dbProvider.createActivity();
                 ActivityContextInterface dbAci = dbACIFactory.getActivityContextInterface(queryActivity);
                 queryActivity.sendQuery(new SelectLongCodeQueryInfo(shortCode));
             catch (StartActivityException e) {
                 // ... handle exception ...
             catch (NoDataSourcesAvailableException e) {
                 // ... handle exception ...
         public void onDatabaseResult(DatabaseResultEvent result, ActivityContextInterface aci) {
             ResultSet rs = result.getResultSet();
             // ... handle result ...
         public void onDatabaseQueryFailure(DatabaseQueryFailureEvent failure, ActivityContextInterface aci) {
             // ... handle failure ...