-->
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.  [ 1 post ] 
Author Message
 Post subject: Calling unmapped stored procedure
PostPosted: Wed Aug 19, 2009 9:40 am 
Newbie

Joined: Tue Mar 10, 2009 11:26 am
Posts: 6
Hi there.

I have read some stuff on the internet (and, of course, on the manual), but I didn't find out how to call a stored procedure without mapping it.
Well, you might ask me why don't I want to map it. In fact, it's because of my boss' order. I have some tables that are used to count a lot of things. In order to manage that dynamically, I have to register formulae of calculation in a stored procedure. So, as I can't know how many stored procedures I will have, I gather their name in a table.

So I can't map all these procedures as I don't know them.
That's why I need your help on how to do that.

As far as I searched, I found I could use a deprecated method. But I'd rather not call it.
There is some code I've found :
Code:
String req = "{? = call nbRestant(?)}";
try
{
    CallableStatement cs = conn.prepareCall(req);
    cs.registerOutParameter( 1, Types.INTEGER);
    cs.setInt(2, ref);
    cs.execute();
    nb = cs.getInt(1);
}
    catch (SQLException e)
{
    e.printStackTrace();
}


Thank you in advance


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

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.