aspose file tools*
The moose likes Spring and the fly likes Spring JDBCTemplate procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring JDBCTemplate procedure" Watch "Spring JDBCTemplate procedure" New topic
Author

Spring JDBCTemplate procedure

Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 208
Hi,

I need to send a request via Spring JDBCTemplate to an Oracle Stored procedure,

the signature of the Oracle procedure is:

PROCEDURE METHOD_NAME (param0 VARCHAR2, param1 newType, param2 NUMBER(19,0) DEFAULT NULL, param3 DATE DEFAULT NULL, param4 VARCHAR2 DEFAULT NULL) AS

where newType is of type "AS TABLE OF number(19)"




what should the method for calling this stored procedure using Spring JDBCTemplate?



currently my code is:



Thanks in Advance,

Niall
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

Please UseCodeTags next time.

I'll move this thread to our Spring forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Look for a class called StoredProcedure from Spring. The constructor is used to setup the in and out parameter type and names, then the execute method is to assign values to the in parameters and to execute the stored procedure and take the out parameters returned.

Then you just instantiate the StoredProcedure implementation and call the execute method.

Here is the documentation
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-StoredProcedure

Or you can also do it this way

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-simple-jdbc-call-1

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring JDBCTemplate procedure