7.6.5. Stored Procedures with jOOQ
A great benefit of jOOQ is its support for working with stored procedures. Stored procedures are extracted to the *.Routines.* package. From there, you can work with them easily. For instance, the following code in Java:
int invoiceId = dsl.nextval(GEN_INVOICE_ID).intValue();spAddInvoice(dsl.configuration(),invoiceId,customerId,invoiceDate);
is equivalent to getting the next value of the generator using the following SQL query:
SELECT NEXT VALUE FOR GEN_INVOICE_IDFROM RDB$DATABASE
and calling the stored procedure after that:
EXECUTE PROCEDURE SP_ADD_INVOICE (:INVOICE_ID, :CUSTOMER_ID, :INVOICE_DATE );
jOOQ also provides tools to build simple DDL queries, but we do not cover them here.
