Querydsl: SQL : Stored procedure support

Created on 3 Oct 2011  路  7Comments  路  Source: querydsl/querydsl

Stored procedure support

Pseudocode

CREATE OR REPLACE PROCEDURE order_update (id INTEGER, customer_id INTEGER, amount OUT DECIMAL);

OrderUpdate orderUpdate = new OrderUpdate(configuration, connection);
// OrderUpdate is generated based on a stored procedure with the same name
orderUpdate.setId(123);
orderUpdate.setCustomerId(7849320);
orderUpdate.execute();
Double amount = orderUpdate.getAmount();
feature

Most helpful comment

Would be very nice to see this features - and it's a feature JOOQ has: http://www.jooq.org/doc/3.2/manual/sql-execution/stored-procedures/

All 7 comments

Closing this for now, since I couldn't find a way to provide typesafe stored procedure support in Querydsl. Feel free to reopen this.

The PreparedStatement.getParameterMetaData() on the SP can be queried in JDBC to generate the types isn't it?

But is this available via database metadata?

Should this not work the same way as tables for the parameter and proc name?
http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetStoredProcedureSignature.htm

For the returned resultset of the prodedure, we can pass in a bean class as
an argument as part of the execute method. The rest all comes from the db
metadata, isn't it?

On Fri, Jan 25, 2013 at 2:13 PM, Timo Westk盲mper
[email protected]:

But is this available via database metadata?

One of the tricky situations may be to properly handle things like the in-out parameters and get them registered in the call, but all this info comes in the metadata so the generated code should be able to handle it easily.

Would be very nice to see this features - and it's a feature JOOQ has: http://www.jooq.org/doc/3.2/manual/sql-execution/stored-procedures/

Was this page helpful?
0 / 5 - 0 ratings