File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Ibatis to pull values from dual defined in stored proc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Ibatis to pull values from dual defined in stored proc" Watch "Ibatis to pull values from dual defined in stored proc" New topic
Author

Ibatis to pull values from dual defined in stored proc

Srinivas Kasani
Greenhorn

Joined: Sep 26, 2008
Posts: 22
I have a stored procedure with return item defined SYS_REFCURSOR. With in stored proc, the cursor is reading values from dual table. I need to read these values which are present in the dual table using Ibatis into java object. When I map these values present in dual table to <ResultMap> I get exception. Below is the outline...

procedure example1(....., ...., outputvalues OUT sys_refcursor, ......)
...
BEGIN
... OPEN outputvalues FOR
select x.value1, x.value2 from DUAL;
.....

<parameterMap .........>
<parameter property="outputvalues" jdbcType="ORACLECURSOR" javaType="java.sql.ResultSet" resultMap="outValues" />
</parameterMap>

<resultMap id="outValues" class="DAOValues">
<result property="daovalue1" column="value1" />
<result property="daovalue2" column="value2" />
</resultMap>

daoValue1 & daoValue 2 are attributes in DAOValues class.
When I try to execute the stored proc, I'm getting error saying "daovalue1" is not defined. Can anyone tell me how to define the column values properly so I can avoid this problem.

Thanks,
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1021
    
    5



should be



Same for daovalue2.
Srinivas Kasani
Greenhorn

Joined: Sep 26, 2008
Posts: 22
Still same error.
Check the outValues
Check the result Mapping for the outValue1 property.
Cause: java.sql.SQLException: Invalid column name.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1021
    
    5

Well it isn't the same error, this time it is complaining about value1 within the PLSQL block.

Are you able to run this procedure on its own, say with something like PLSQL Developer?
Srinivas Kasani
Greenhorn

Joined: Sep 26, 2008
Posts: 22
Yes
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1021
    
    5

I think you may need to define your ibatis config differently. Something like the following.



I think the important bit you have missed is defining the mode of each parameter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ibatis to pull values from dual defined in stored proc