<resultMap id="userMap" class="user">
<result property="userid" column="USR_ID"/>
<result property="password" column="USR_PWD"/>
<result property="username" column="USR_NAME"/>
<result property="role" column="ROLE_ID"/>
<result property="code" column="USR_CODE"/>
<result property="email" column="EMAIL_ID"/>
<result property="phoneno" column="PHONE_NUMBER"/>
<result property="description" column="DESCRIPTION"/>
<result property="listDynamicProperties" resultMap="User.userMap1"/>
</resultMap>
<resultMap id="userMap1" class="dynamicProperty">
<result property="propertyName" column="PROPERTY_NAME"/>
<result property="propertyValue" column="PROPERTY_VALUE"/>
</resultMap>
These are my bean classes:
public class User
{
public
User()
{
}
private
List listDynamicProperties;
private
String userid;
private String
username;
private int
role;
public
String getUsername() {
return
username;
}
public void setUsername(String username)
{
this.username = username;
}
public int getRole()
{
return
role;
}
public void setRole(int role)
{
this.role = role;
}
public String getUserid() {
return
userid;
}
public void setUserid(String userid)
{
this.userid = userid;
}
public List
getListDynamicProperties()
{
return
listDynamicProperties;
}
public void setListDynamicProperties(ArrayList
listDynamicProperties1)
{
this.listDynamicProperties
=
listDynamicProperties1;
}
}
private String propertyName;
private String propertyValue;
/*
* name and value should not be null.
* If null throw Exception.
*/
public DynamicProperty()
{
}
return propertyName;
}
this.propertyName = propertyName;
}
return propertyValue;
}
System.out.println("Setting DynamicProperties");
this.propertyValue = propertyValue;
}
<select id="select4" resultMap="userMap">
select BASIC.USR_ID, BASIC.USR_NAME, BASIC.ROLE_ID,EXTENSIN.PROPERTY_NAME,EXTENSIN.PROPERTY_VALUE from USR_BASIC_INFO BASIC, USR_EXTENSION_INFO EXTENSIN where BASIC.USR_ID=EXTENSIN.USR_ID;
</select>
Now i am getting four results. where i am expecting two results.
i am getting the result as "4 User objects" and the data as:
1,xxxx, 200, city, foster city
1,xxxx, 200,state, california
From: Poitras Christian [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 18, 2006 9:40 PM
To: [email protected]
Subject: RE: Urgent help Needed - Join Query
Sent: Tuesday, 18 April 2006 11:22
To: [email protected]
Subject: Urgent help Needed - Join Query
private String UserName;
private String Designation;
private String Address;
public String getUserName() { return UserName; }
public void setAddress(String address) { Address = address; }
public void setUserName(String userName) { UserName = userName; }
private String City;
private String State;
public void setUserId(String userId) { UserId = userId; }
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com |
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com |
