cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Toffetti <>
Subject Re: Code Generation for Stored Procedures
Date Wed, 04 Nov 2009 20:07:07 GMT
Michael Gentry <mgentry <at>> writes:
> Hi Daniel,
> I'm assuming you've used the "Create Stored Procedure" button in
> Cayenne Modeler?  This doesn't actually create the stored procedure
> itself (you can't type the SP definition into the modeler).  What it
> does is define/model a SP that you can use Cayenne to call through
> your code.  This probably isn't documented very well, but here is what
> we currently have for calling the SP in your code:
> mrg

    Thanks for the link, I've read it already. Ohh, now I understand,
sorry if I wasn't clear enough.
    The stored procedures are already implemented in the database and
the modeler retrieves them, but I was expecting some kind of code
generation of a "dao" kind of class, think of something like this:

public class MyCustomProcSPDAO {

    private Double outputParam;

    public Collection<ExpectedResultClass> execute(String param1,
                                                   Integer param2) {

        ProcedureQuery query = new ProcedureQuery("MyCustomProc");

        query.addParam("param1", param1);
        query.addParam("param2", param2);

        QueryResponse result = ctxt.performGenericQuery(query);

        // retrieve output parameters
        outputParam = <<...>>

        //retrieve results as a type safe collection
        Collection<ExpectedResultClass> resultCollection = <<...>>

        return resultCollection;

    public Double getOutputParam() {
        return outputParam;


    Is this possible writing custom templates ??

Thanks and regards,


View raw message