| How to call a stored procedure with Hibernate ? |
| Written by Mark S. | |||||
|
JBoss recipe of the day Supposing you have the following Oracle Stored procedure: Invoking it from Hibernate requires mapping the Stored Procedure in the Person class.
<sql-query name="SP_agenda" callable="true">
<return alias="ev" class="Person">
<return-property name="id" column="id"/>
<return-property name="name" column="person_name"/>
<return-property name="surname" column="person_surname"/>
<return-property name="address" column="person_address"/>
</return>
{ ? = call agenda() }
</sql-query>
Then, you can execute the procedure just like a normal Query:
Query query = session.getNamedQuery("SP_agenda");
List results = query.list();
JBoss.org Search
Custom Search
Only registered users can write comments!
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |


