Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Stored Procedure from hibernate

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic