ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jasmin Mehta <Jasmin_Me...@nexweb.org>
Subject Re: How to define alias in <resultMap>
Date Fri, 27 Mar 2009 16:03:31 GMT
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.goodin@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!            
******************************************************************************


Mime
View raw message