These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Stored Procedure Call
PostPosted: Thu Mar 30, 2006 5:39 am 
Newbie

Joined: Thu Mar 30, 2006 5:31 am
Posts: 2
Hello !

I searched everywhere but I didn't find an answer...

I want to call a Stored Procedure but it doesn't return anything. It is just a simple procedure that upgrades a table for a given ID :

Code:
CREATE OR REPLACE
PROCEDURE MY_STORE_PROCEDURE(id NUMBER) IS

BEGIN
 
  UPDATE my_table...
 
END;


Is it possible to call such a procedure with hibernate ?

I think it should be something like :

Code:
getSession().createSQLQuery("BEGIN MY_STORE_PROCEDURE(55); END;")...


But I can't call "executeUpdate" or something like that...

Do you have an idea ?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 10:18 am 
Newbie

Joined: Thu Mar 30, 2006 5:31 am
Posts: 2
I read a lot of posts and articles about my problem...
It seems that Hibernate can't handle Stored Procedures with No ResultSet as result.
Even if the Stored Procedure returns a value, it's impossible to use Hibernate with it.

Maybe I am wrong but that is my conclusion for the moment...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 7:25 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
section 17.3.2 of Hibernate 3 documentation:
Hibernate 3 introduces support for queries via stored procedures. The stored procedures must return a resultset as the first out-parameter to be able to work with Hibernate.

That said, you could use a SP to update data in the database and then return a cursor that contains the number of updated rows.

Curtis ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 7:26 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
section 17.3.2 of Hibernate 3 documentation:
Hibernate 3 introduces support for queries via stored procedures. The stored procedures must return a resultset as the first out-parameter to be able to work with Hibernate.

That said, you could use a SP to update data in the database and then return a cursor that contains the number of updated rows.

Curtis ...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.