You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Andrus Adamchik (JIRA)" <de...@cayenne.apache.org> on 2008/08/03 22:27:11 UTC

[jira] Created: (CAY-1089) Generating SQLTemplate and Procedure Access Code

Generating SQLTemplate and Procedure Access Code
------------------------------------------------

                 Key: CAY-1089
                 URL: https://issues.apache.org/cayenne/browse/CAY-1089
             Project: Cayenne
          Issue Type: Task
          Components: Cayenne Core Library
    Affects Versions: 3.0
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik
             Fix For: 3.0


[Splitting from CAY-1070]

The goal to generate a flexible type-safe code to invoke stored procedures and mapped  SQLTemplates, similar to CAY-1070 implementation for SelectQueries.

This feature should target class generation in "datamap" mode with Ant (via 'cgen' task [1]) and CayenneModeler (later this needs to be ported to the Maven plugin as well). For each ProcedureQuery and SQLTemplate query, a method would have to return a generic QueryResponse object, as we don't have enough info to tell whether the query is selecting or updating or both (although we can do something smart about SQLTemplates, such as greping for SELECT in the beginning of the query).

  public QueryResponse performQuery2(ObjectContext, Object parameter1, Object parameter2) {
   // bind parameters and
     // run the query here
  }

The number, names and order of parameters must match that of the mapped query (not yet sure how to do with with SQLTemplate or ProcedureQuery). Also we need to do something smart about parameter types.

For each stored procedure that does not have at least one procedure query, create a method that builds a procedure query on the fly. Method name is based on stored procedure name.

public QueryResponse performProcedure2(ObjectContext, Object parameter1, Object parameter2) {
  // Create ProcedureQuery
 // bind parameters and
   // run the query here
}



[1] http://cayenne.apache.org/doc/cgen.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.