Hi Jasmin,
you should be able to set different column names in your resultmap like <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="CDV_FIRST_NAME"/> <result property="customerDependentVo.depLastName" column=" CDV_LAST_NAME"/> </resultMap> And then use appropriate aliases in your sql query: <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 cdv_first_name, dep.last_name as cdv_last_name FROM qol_customer cu, qol_dependent dep WHERE AND cu.cust_id = dep.cust_id (+) </select> cheers benjamin _____ Von: Jasmin Mehta [mailto:jasmin_me...@nexweb.org] Gesendet: Freitag, 27. März 2009 17:52 An: user-java@ibatis.apache.org Betreff: How to define alias in <resultMap> Hi, With below code how do I get correct value for dependent first name and dependent last name? Right now as both qol_customer and qol_dependet has same field name for FIRST_NAME and LAST_NAME, I am getting qol_customer's FIRST_NAME and LAST_NAME populated in customerDependentVo.depFirstName customerDependentVo.depLastName properties. Is there any way I can define in <resultMap> that such field is coming from such and such table? Thanks Jasmin <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="FIRST_NAME"/> <result property="customerDependentVo.depLastName" column="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, 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! **************************************************************************** **