ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esperanza.Echever...@steria.es
Subject Re: how to use function in resultMap
Date Wed, 28 Jun 2006 07:40:18 GMT
ok, it was really strange not to work with alias.

bye, bye.

 
 


Esperanza Echeverría de Miguel
Steria España http://www.steria.es
C/Menéndez y Pelayo,3 bis 46010 Valencia
Tel: + 34 96 393 87 50 Fax: +34 96 393 87 51
esperanza.echeverria@steria.es

 
 




puneet arya <puneet_arya_old@yahoo.co.in>
28/06/2006 09:35
Please respond to user-java

 
        To:     user-java@ibatis.apache.org
        cc: 
        Subject:        Re: how to use function in resultMap


hi,
  thank you very much it is working with alias .. :-)
Regards,
Puneet Arya

Esperanza.Echeverria@steria.es wrote:

i send you an example of my code that works.... 

 <resultMap id="emp" class="A14"> 
        <result property="ars_codi" column="ARS_CODI" /> 
        <result property="a14_fech" column="A14_FECH" /> 
        <result property="a14_fdes" column="A14_FDES" /> 
        <result property="a14_fhas" column="A14_FHAS" /> 
        <result property="usi_codi" column="USI_CODI" /> 
    </resultMap> 
 
 
  <parameterMap id="swapParameters" class="java.util.HashMap" > 
    <parameter property="usi_codi" jdbcType="VARCHAR" 
javaType="java.lang.String" mode="OUT"/> 
    <parameter property="a14" jdbcType="ORACLECURSOR" mode="OUT" 
resultMap="emp"/> 
  </parameterMap> 
 
  <procedure id="swapEmailAddresses" parameterMap="swapParameters" > 
    {call sipj2ee.prueba(?,?)} 
  </procedure> 

in the PL: 

TYPE ref_cursor_t IS REF CURSOR; 

procedure prueba (usicodi out VARCHAR2,mia14 out ref_cursor_t) is 
begin 
select usi_codi into usicodi from a14 where usi_codi='Diego'; 
  open mia14 for 
          select ars_codi, a14_fech, a14_fdes, a14_fhas, usi_codi 
 from a14 where usi_codi='Diego'; 
end;


and in the A14.java i have defined the colums with the name ars_codi, 
a14_fech,a14_fdes, a14_fhas, usi_codi with getters and setters... 

BYE.

Esperanza Echeverría de Miguel
Steria España http://www.steria.es
C/Menéndez y Pelayo,3 bis 46010 Valencia
Tel: + 34 96 393 87 50 Fax: +34 96 393 87 51
esperanza.echeverria@steria.es





puneet arya <puneet_arya_old@yahoo.co.in> 
28/06/2006 09:16 
Please respond to user-java 
        
        To:        user-java@ibatis.apache.org 
        cc:         
        Subject:        Re: how to use function in resultMap



hi, 
thx 
Puneet Arya

Esperanza.Echeverria@steria.es wrote: 

i have made an oraclecursor with alias in the columns and i have no 
problem... i don´t understand.... 

if you put the select in this way and compile the procedure,  what is the 
error you obtain?? 

select sum(salary) SALARY from employeeInfo; 

no other ideas, sorry.

Esperanza Echeverría de Miguel
Steria España http://www.steria.es
C/Menéndez y Pelayo,3 bis 46010 Valencia
Tel: + 34 96 393 87 50 Fax: +34 96 393 87 51
esperanza.echeverria@steria.es





puneet arya <puneet_arya_old@yahoo.co.in> 
28/06/2006 09:09 
Please respond to user-java 
        
       To:        user-java@ibatis.apache.org 
       cc:         
       Subject:        Re: how to use function in resultMap




hi, 
  Yes You are right ki  should not have name in the resultMap but alias we 
cant put like that . not only in this case(where i m using sum function) but in the normal
 case when we are using resultMap alias can't be used . 
Regards, 
Puneet Arya

Esperanza.Echeverria@steria.es wrote: 

but if in yout select you only have the salary column and not the name you 
must erase the name column in the resultmap....
<resultMap id="spEmployeeInfo" class = "employee"> 

<result property="salary" column = "SALARY"/> 
</resultMap> 
and to put the alias "salary" in the pl select. 

Esperanza Echeverría de Miguel
Steria España http://www.steria.es
C/Menéndez y Pelayo,3 bis 46010 Valencia
Tel: + 34 96 393 87 50 Fax: +34 96 393 87 51
esperanza.echeverria@steria.es





puneet arya <puneet_arya_old@yahoo.co.in> 
28/06/2006 07:39 
Please respond to user-java 
        
      To:        user-java@ibatis.apache.org 
      cc:         
      Subject:        how to use function in resultMap





Hi, 
 I am trying to use sum function (Pl/Sql) in my stored procedure as 

select sum(salary) from employeeInfo; 

But while defining a result Map i m writing as 
<resultMap id="spEmployeeInfo" class = "employee"> 
<result property="name" column = "NAME"/> 
<result property="salary" column = "SALARY"/> 
</resultMap> 
and in parameterMap 

<parameterMap id = "inputEmployeeMap" class = "employeeMap" > 
<parameter property="name" jdbcType="VARCHAR2" avaType="java.lang.String" mode="IN"/>

<parameter property="outputname" jdbcType="ORACLECURSOR" mode = "OUT" resultMap = "spEmployeeInfo"
/> 
</parameterMap> 

<procedure id = "getEmployeeList" parameterMap="inputEmployeeMap" resultMap="spEmployeeInfo">

{ call SP_EMPLOYEE(?, ?) } 
</procedure> 

But because i m using the sum function so it is giving error like 
 
The error occurred while applying a result map.
Check the Employee.spEmployeeInfo.
Check the result mapping for the 'salary' property.
Cause: java.sql.SQLException: Invalid column name 

So how to Use the sum function in my case,,please suggest 
Regards, 
Puneet Arya 
Yahoo! India Answers: Share what you know. Learn something new Click here
Catch all the FIFA World Cup 2006 action on Yahoo! India Click here 
Yahoo! India Answers: Share what you know. Learn something new Click here
Catch all the FIFA World Cup 2006 action on Yahoo! India Click here 
Yahoo! India Answers: Share what you know. Learn something new Click here
Catch all the FIFA World Cup 2006 action on Yahoo! India Click here 

 Yahoo! India Answers: Share what you know. Learn something new Click here
Catch all the FIFA World Cup 2006 action on Yahoo! India Click here


Mime
View raw message