Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 64627 invoked from network); 4 Dec 2008 01:26:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Dec 2008 01:26:39 -0000 Received: (qmail 69841 invoked by uid 500); 4 Dec 2008 01:26:51 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 69190 invoked by uid 500); 4 Dec 2008 01:26:49 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 69179 invoked by uid 99); 4 Dec 2008 01:26:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 17:26:49 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dturkenk@gmail.com designates 74.125.78.147 as permitted sender) Received: from [74.125.78.147] (HELO ey-out-1920.google.com) (74.125.78.147) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Dec 2008 01:25:20 +0000 Received: by ey-out-1920.google.com with SMTP id 4so1681129eyg.60 for ; Wed, 03 Dec 2008 17:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=b05NwsSIA6VDBI4zl4oWR8aIDCNFailqVSvDEZu1s6w=; b=ITAkFc0IHgWQuTDrhz+OQ83hBDdyK15JAwV/S/L+PTZZ12Mk1NM5M3iQZHpN+c/9Gg kh4LOiAS7rsY9vVUQFSVedWhLWpT8B3XwyxaPWh6Hkpy0PPKSgVESivj99MKoaJaPn8O 4vysgfDAri7tHeVjgiicTqha/BayKgcJZc1tc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=wMQ1q6uBAAHvBwI3rom1AkOG6DQ3pWEOj/OPwGsV4cncq6qhx1oAflGuJd5nKYNQB0 VHrJo8FxJgl3tuhrYGBrkT5NJkNhlSyTFSgVPi3AK3/nRL6MDEc/EKNTRg4SYSv3crBj zVJ0q/bz9+L2lBoFbiMs6AsiCj3l/FOeep/UA= Received: by 10.103.172.9 with SMTP id z9mr6581907muo.109.1228353957457; Wed, 03 Dec 2008 17:25:57 -0800 (PST) Received: by 10.103.231.1 with HTTP; Wed, 3 Dec 2008 17:25:57 -0800 (PST) Message-ID: <35dbee350812031725t30a355e0nc273e8ab0b09b95f@mail.gmail.com> Date: Wed, 3 Dec 2008 20:25:57 -0500 From: "Dan Turkenkopf" To: user-java@ibatis.apache.org Subject: Immutable objects in ResultMaps MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_370_22556011.1228353957473" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_370_22556011.1228353957473 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Maybe I'm just missing something, but I thought that iBATIS required the objects used in a result map to have declared setters. I was in the process if I could figure out a way to use a builder pattern to get immutable objects through iBATOR and was working my way through a sample application. To my surprise, when I removed the setters from my domain object, everything still seemed to work. Did I miss this functionality being introduced? Thanks, Dan Turkenkopf Here's my domain object: public class Master { private String id; private String firstName; private String lastName; /** * @return the firstName */ public String getFirstName() { return firstName; } /** * @return the id */ public String getId() { return id; } /** * @return the lastName */ public String getLastName() { return lastName; } And here's my SQL Map: ------=_Part_370_22556011.1228353957473 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Maybe I'm just missing something, but I thought that iBATIS required the objects used in a result map to have declared setters.

I was in the process if I could figure out a way to use a builder pattern to get immutable objects through iBATOR and was working my way through a sample application.

To my surprise, when I removed the setters from my domain object, everything still seemed to work.

Did I miss this functionality being introduced?

Thanks,
Dan Turkenkopf

Here's my domain object:

public class Master {

    private String id;
    private String firstName;
    private String lastName;
   
    /**
     * @return the firstName
     */
    public String getFirstName() {
        return firstName;
    }
    /**
     * @return the id
     */
    public String getId() {
        return id;
    }
    /**
     * @return the lastName
     */
    public String getLastName() {
        return lastName;
    }

And here's my SQL Map:

<sqlMap namespace="Master">

  <!-- Result maps describe the mapping between the columns returned
       from a query, and the class properties.  A result map isn't
       necessary if the columns (or aliases) match to the properties
       exactly. -->
  <resultMap id="MasterResult" class="com.techegesis.immutable.domain.Master">
    <result property="id" column="lahmanid"/>
    <result property="firstName" column="nameFirst"/>
    <result property="lastName" column="nameLast"/>
  </resultMap>

  <!-- Select with no parameters using the result map for Master class. -->
  <select id="selectAllMasters" resultMap="MasterResult">
    select * from MASTER
  </select>

</sqlMap>


------=_Part_370_22556011.1228353957473--