-->
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.  [ 5 posts ] 
Author Message
 Post subject: Using stored procedure which is not related to data retrival
PostPosted: Fri Apr 28, 2006 4:40 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 3:44 am
Posts: 32
Can we call a stored procedure through a java class in hibernate which is not at all involved related to retrieval of the data from the table?

I have seen usage of stored procedure which is used in retrieving values of certain columns of a table, using hbm files and named queries......

but my pupose is some what different, I just want to call one stored procedure...


Sudhir


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 5:06 am 
Regular
Regular

Joined: Wed Aug 25, 2004 6:23 am
Posts: 91
Yes, you can call session.connection() to retrieve the JDBC connection and then call the stored procedure as normal using a CallableStatement.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 7:07 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 3:44 am
Posts: 32
Is there any other ways of doing the same ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 9:06 am 
Regular
Regular

Joined: Wed Aug 25, 2004 6:23 am
Posts: 91
I guess that you could use a named sql query in your mapping, eg something like:-

Code:
<sql-query name="callMyStoredProcedure">
    <return-scalar column="result" type="long"/>
    { ? = call myStoredProcedure() }
</sql-query>


What is it exactly that you're trying to do?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 9:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes, and why is it bad to use a connection to do what it is supposed to be used to ? ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.