-->
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: HELP Oracle- stored procedures - In and Out Parameters.
PostPosted: Thu Nov 10, 2005 7:22 am 
Newbie

Joined: Tue Oct 18, 2005 2:51 am
Posts: 14
Location: Chennai, India
Hi everybody.

I need some help

I have a class with attributes: int id and String name.

I have Oracle Stored Procedure getstudents (In Id, OUT Name)

For a give In Parameter ID , the out parameter name will be generated.

Things are working well from JDBC, but I need to implement it through Hibernate.

If any body can show the xml amapping and code snippets it will be of great help to me.

Note : I have already gone thru all the meterials available but I cannot exactly understand the mapping of In and and out parameters.

Thanks
Niel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 7:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
as the documentation EXPLICITLY states we currently only support stored procedures that returns a resultset.

btw. is your storedprocedure really named getStudents and not getStudent ? I'm curious since people do weird things with stored procedures and were wondering if you did something "weird" to return multiple students or ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Is there any option for creating plain jbdc connection from
PostPosted: Thu Nov 10, 2005 8:12 am 
Newbie

Joined: Tue Oct 18, 2005 2:51 am
Posts: 14
Location: Chennai, India
Hi Max,

Sorry for the typo, its getStudent , drop the s. The procedure in no way returns any list.

I am bit disappointed but I dont want to dump Hibernate for one such small shortcoming.

But I get into another problem then, if I keep Hibernate, I have to do the plain JDBC stuff through Hibernate for stored procedures.

Do you think there is any way to do the jdbc stuff through Hibernate? Please ignore typos.

Thanks a lot for earlier reply. I am adding the jdbcd code snippet which you can see and comment.

with warm regards
Niel


Connection con = DriverManager.getConnection( "jdbc:oracle:thin:@something ", "scott" ,"tiger");

CallableStatement stmt = con.prepareCall("{call getstudent(?,?)}");

// Here I am setting the Student Id
stmt.setInt(1, 7844);

stmt.registerOutParameter(2, java.sql.Types.VARCHAR);
stmt.executeQuery();

// Here I am getting the Student Name from out parameter.
System.out.println("Name " + stmt.getString(2));


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 8:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can always add a stored procedure that wraps your procedure to make it return a resultset.

In a future version we will attempt support simple out bindings.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 8:27 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
session.connection()


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.