aspose file tools*
The moose likes Object Relational Mapping and the fly likes Calling Stored Procedure from hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Calling Stored Procedure from hibernate" Watch "Calling Stored Procedure from hibernate" New topic
Author

Calling Stored Procedure from hibernate

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
Limitations of Hibernate
In this link, it states that
For Sybase or MS SQL server the following rules apply:

The procedure must return a result set. Note that since these servers can return multiple result sets and update counts, Hibernate will iterate the results and take the first result that is a result set as its return value. Everything else will be discarded.


I have created a stored procedure and calling it from hibernate.
Stored procedure (mysql) when executed in console prints something like this
mysql> call getPol(1000,'Left')
+------+
| a |
+------+
| 1001 |
+------+
1 row in set (0.00 sec)

+------+
| a |
+------+
| 1002 |
+------+
1 row in set (0.01 sec)

+------+
| a |
+------+
| 1003 |
+------+
1 row in set (0.01 sec)

+------+
| a |
+------+
| 1004 |
+------+
1 row in set (0.02 sec)

+------+
| a |
+------+
| 1008 |
+------+
1 row in set (0.02 sec)

+------+
| a |
+------+
| 1009 |
+------+
1 row in set (0.03 sec)

+------+
| a |
+------+
| 1010 |
+------+
1 row in set (0.03 sec)

Part of stored procedure

This Procedure when called from hibernate, returns the first result (1001)

So, what is the solution to this Problem? I need to get all numbers (which got printed in console) in a list


kunal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling Stored Procedure from hibernate