com.ibm.websphere.ejbquery

Interface Query

  • All Superinterfaces:
    javax.ejb.EJBObject, java.rmi.Remote


    public interface Query
    extends javax.ejb.EJBObject
    EJB Remote interface for the WebSphere dynamic ejb query service. An ejb query can be executed using the executeQuery( ) method. To execute a query a number of times with different input parameters, you may use the prepareQuery( ) method and repeated calls to the executePlan( ) method.

    When using the remote interface for the query service, any references to EJB Objects in the query statement will be to remote interfaces.

    For example, the ejb query statement

         select object(o) from myBean o 
     

    will return references to the remote interface for myBean.

    The dynamic query remote interface will create a fully materialized result set. To create a demand driven result set use the query service local interface. QueryLocal To control the size of a potentially large result set, you must pass a maxRow value. The QueryIterator has a method to determine if the result set was truncated. QueryIterator.isComplete() You can use skipRows to execute the query again and retrieve the next set of tuples.

    For example,

         // this query call will retrieve the first 100 beans
         executeQuery("select object(o) from myBean o", null, null, 0, 100);
         // this query call will retrieve the next  100 beans
         executeQuery("select object(o) from myBean o", null, null, 100, 100);
     

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      QueryIterator executePlan(java.lang.String queryPlan, java.lang.Object[] parameterVars, int skipRows, int maxRows)
      execute a query plan that was returned by the prepareQuery method.
      QueryIterator executeQuery(java.lang.String queryStatement, java.lang.Object[] parameterVars, java.util.Properties queryDomain, int skipRows, int maxRows)
      validate and execute an ejb query statement
      java.lang.String prepareQuery(java.lang.String queryStatement, java.lang.Object[] parameterVars, java.util.Properties queryDomain)
      validate the ejb query statement and return a query plan in the form of a String that can be used with the executePlan method.
      • Methods inherited from interface javax.ejb.EJBObject

        getEJBHome, getHandle, getPrimaryKey, isIdentical, remove
    • Method Detail

      • executePlan

        QueryIterator executePlan(java.lang.String queryPlan,
                                java.lang.Object[] parameterVars,
                                int skipRows,
                                int maxRows)
                                  throws java.rmi.RemoteException,
                                         QueryException
        execute a query plan that was returned by the prepareQuery method.
        Parameters:
        queryPlan - The String returned from a prepareQuery method.
        parameterVars - The values to be substituted for any query parameters in the query statement. The datatypes of the parameters must be the same as the datatypes passed in on the prepareQuery call.
        skipRows - Number of tuples in the final result set to skip.
        maxRows - Maximum number of tuples to return in result set.
        Throws:
        QueryException - Indicates an invalid query plan, a server or database error occurred, or the query invoked an application method which threw an exception.
        java.rmi.RemoteException
      • executeQuery

        QueryIterator executeQuery(java.lang.String queryStatement,
                                 java.lang.Object[] parameterVars,
                                 java.util.Properties queryDomain,
                                 int skipRows,
                                 int maxRows)
                                   throws java.rmi.RemoteException,
                                          QueryException
        validate and execute an ejb query statement
        Parameters:
        queryStatement -
        parameterVars - The values to be substituted for any query parameters in the query statement.
        queryDomain - Normally a null value. This parameter is null in the cases where the Abstract Schema Names (ASN) used in the query statement are unique in the server scope. If ASN names are not unique across applications in the server, then the ASN name must be qualified by its EJB Home reference. This takes the form of name/value pairs (ASN name, EJB Home object reference). An EJB Home reference can be obtained from a name service lookup call.
        skipRows - Number of tuples in the final result set to skip.
        maxRows - Maximum number of tuples to return in result set.
        Throws:
        QueryException - Indicates an invalid query plan, a server or database error occurred, or the query invoked an application method which threw an exception.
        java.rmi.RemoteException
      • prepareQuery

        java.lang.String prepareQuery(java.lang.String queryStatement,
                                    java.lang.Object[] parameterVars,
                                    java.util.Properties queryDomain)
                                      throws java.rmi.RemoteException,
                                             QueryException
        validate the ejb query statement and return a query plan in the form of a String that can be used with the executePlan method.
        Parameters:
        queryStatement -
        parameterVars - The values to be substituted for any query parameters in the query statement. The datatypes of the values but not the actual values are used in validating the query.
        queryDomain - Normally a null value. See executeQuery(java.lang.String, java.lang.Object[], java.util.Properties, int, int)
        Throws:
        QueryException - Indicates an invalid query plan, a server or database error occurred, or the query invoked an application method which threw an exception.
        java.rmi.RemoteException
IBM WebSphere Application ServerTM
Release 8.5