• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Ibatis to pull values from dual defined in stored proc

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


should be



Same for daovalue2.
 
Srinivas Kasani
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still same error.
Check the outValues
Check the result Mapping for the outValue1 property.
Cause: java.sql.SQLException: Invalid column name.
 
James Boswell
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes
 
James Boswell
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic