ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From OscarCampos <oscar.cam...@copart.com>
Subject How to Map 2 Columns to a List Property in an Object
Date Tue, 15 Jan 2008 00:07:45 GMT

The issue that we are facing is that we have an object that has a property
that is a List<String>. That List<String> is to be populated by the
database, using to different columns. We need to be able to take each column
and just add it to the List. Is there anyway of accomplishing this? Below
you will see an example of the code we are using:

public class SomeClass
    Address address;
    //.. more properties
    public Address getAddress(); //Returns address
    public void setAddress(Address address); //Sets address
    //... more methods

public class Address
  private List<String> addressLines;
  //.. more properties
  public List<String> getAddressLines();
  public void setAddressLines(List<String> addressLines);
  //... more methods

<sqlMap namespace="someAddress">

  <resultMap id="someAddressResult" class="SomeClass">
		<result property="address.addressLine" column="ADDRESS1"/> //First address
		<result property="address.addressLine" column="ADDRESS2"/> //Second
address line
                //.... more columns

   <parameterMap id="someAddressParams" class="map">
      // Some params

  <procedure id="someAddressSProc" parameterMap="someAddressParams"
		{call addressSProc(?, ?, ?, ?, ?)}
View this message in context: http://www.nabble.com/How-to-Map-2-Columns-to-a-List-Property-in-an-Object-tp14820939p14820939.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message