querydsl / querydsl

Unified Queries for Java

Home Page:https://querydsl.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL : Stored procedure support

timowest opened this issue · comments

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();

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
notifications@github.comwrote:

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/

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.