alias in SQL will work, Sorry I overlooked the SQL change earlier in first 
posting. And just saw the table column name in resultMap. I apologies.

Thanks for all your help.



From:
Brandon Goodin <brandon.goo...@gmail.com>
To:
user-java@ibatis.apache.org
Date:
03/27/2009 12:29 PM
Subject:
Re: How to define alias in <resultMap>


You know rethinking your statement. It makes no sense. You just showed us 
the SQL. You can add an alias in the SQL. It does *not* change your table. 
It only changes the column name in the result. Then you just map it in the 
resultMap like we originally said.

Brandon


On Fri, Mar 27, 2009 at 11:10 AM, Brandon Goodin <brandon.goo...@gmail.com
> wrote:
You can specify the columnIndex (yuck).

        <result property="customerDependentVo.depFirstName" 
columnIndex="..."/>      
        <result 
property="customerDependentVo.depLastName" columnIndex ="..."/>  

Brandon Goodin
Silver Mind Software
http://www.silvermindsoftware.com
bgoo...@silvermindsoftware.com
615-306-3652
http://www.linkedin.com/in/bgoodin



On Fri, Mar 27, 2009 at 11:03 AM, Jasmin Mehta <jasmin_me...@nexweb.org> 
wrote:

I can not change the column names of table QOL_DEPENDENT 

from FIRST_NAME to DEP_FIRST_NAME 

It has to be the same. 



From: 
Brandon Goodin <brandon.goo...@gmail.com> 
To: 
user-java@ibatis.apache.org 
Date: 
03/27/2009 11:59 AM 
Subject: 
Re: How to define alias in <resultMap>



<typeAlias alias="customerVo"  
             type="org.nexweb.qol.gcc.model.CustomerVO"/>  

<resultMap id="customerRS" class="customerVo">  
        <result property="custStatus" column="CUST_STATUS"/>  
        <result property="firstName" column="FIRST_NAME"/>  
        <result property="middleName" column="MIDDLE_NAME"/>  
        <result property="lastName" column="LAST_NAME"/>  
        <result property="customerDependentVo.depFirstName" 
column="DEP_FIRST_NAME"/>     
        <result property="customerDependentVo.depLastName" 
column="DEP_LAST_NAME"/> 
</resultMap>  


 <select id="getListOfCustomersBySSNMask" resultMap="customerRS" 
parameterClass="java.util.Map">  
      SELECT  
            cs.cust_status, cu.first_name,  cu.middle_name, 
 cu.last_name,  
            dep.first_name as dep_first_name,  dep.last_name as 
dep_last_name 
   FROM  
             qol_customer cu,  
             qol_dependent dep              
        WHERE  
            AND cu.cust_id = dep.cust_id  (+)  
</select>  

public class CustomerVO implements Serializable {  
    private Integer custId;      
    private Integer custStatus;  
    private String firstName;  
    private String middleName;  
    private String lastName;  

    private CustomerDependentVO customerDependentVo;    
 ... all the accessor methods 

}  

public class CustomerDependentVO implements Serializable  
{  
  private Integer custId;  
  private String depFirstName; 
  private String depLastName;  
  private String depMiddleName;  

  ... all the accessors  
} 

******************************************************************************
This email and any files transmitted with it are intended solely for 
the use of the individual or agency to whom they are addressed. 
If you have received this email in error please notify the Navy 
Exchange Service Command e-mail administrator. This footnote 
also confirms that this email message has been scanned for the
presence of computer viruses.

Thank You!            
******************************************************************************

Reply via email to