Class ProcedureCall<T>

java.lang.Object
org.apache.cayenne.query.IndirectQuery
org.apache.cayenne.query.ProcedureCall<T>
All Implemented Interfaces:
Query

public class ProcedureCall<T> extends IndirectQuery
Fluent API for calling stored procedures.
Since:
4.0
  • Field Details

    • procedureName

      protected String procedureName
    • resultClass

      protected Class<T> resultClass
    • params

      protected Map<String,Object> params
    • fetchLimit

      protected Integer fetchLimit
    • fetchOffset

      protected Integer fetchOffset
    • capsStrategy

      protected CapsStrategy capsStrategy
    • fetchingDataRows

      protected Boolean fetchingDataRows
    • resultDescriptor

      protected ProcedureColumn[] resultDescriptor
  • Constructor Details

    • ProcedureCall

      public ProcedureCall(String procedureName)
    • ProcedureCall

      public ProcedureCall(String procedureName, Class<T> resultClass)
  • Method Details

    • query

      public static ProcedureCall<DataRow> query(String procedure)
      Creates procedure call using name of stored procedure defined in the mapping file. With no result class specified, the result sets are returned as data rows.
    • dataRowQuery

      public static ProcedureCall<DataRow> dataRowQuery(String procedure)
      Creates procedure call returning data rows using name of stored procedure defined in the mapping file.
    • query

      public static <T> ProcedureCall<T> query(String procedure, Class<T> resultClass)
      Creates procedure call using name of stored procedure defined in the mapping file and specifies data type of the objects it should return.
    • params

      public ProcedureCall<T> params(Map<String,?> parameters)
    • param

      public ProcedureCall<T> param(String name, Object value)
    • limit

      public ProcedureCall<T> limit(int fetchLimit)
    • offset

      public ProcedureCall<T> offset(int fetchOffset)
    • capsStrategy

      public ProcedureCall<T> capsStrategy(CapsStrategy capsStrategy)
    • resultDescriptor

      public ProcedureCall<T> resultDescriptor(ProcedureColumn[] resultDescriptor)
    • call

      public List<QueryResult> call(ObjectContext context)
      Executes the procedure, returning all of its result sets, update counts and OUT parameters in the order they were produced.
    • select

      public List<T> select(ObjectContext context)
      Executes the procedure, returning its first result set.
      Throws:
      CayenneRuntimeException - if the procedure produced no result sets.
    • batchUpdate

      public int[] batchUpdate(ObjectContext context)
      Executes the procedure, returning the counts of its first update.
      Throws:
      CayenneRuntimeException - if the procedure produced no updates.
    • update

      public int update(ObjectContext context)
      Executes the procedure, returning the count of its first update.
      Throws:
      CayenneRuntimeException - if the procedure produced no updates, or the first one is a batch update.
    • createReplacementQuery

      protected Query createReplacementQuery(EntityResolver resolver)
      Description copied from class: IndirectQuery
      Creates a substitute query. An implementor is free to provide an arbitrary replacement query.
      Specified by:
      createReplacementQuery in class IndirectQuery