Setter is expected if column name is same as property name
----------------------------------------------------------

                 Key: IBATIS-624
                 URL: https://issues.apache.org/jira/browse/IBATIS-624
             Project: iBatis for Java
          Issue Type: Bug
          Components: SQL Maps
    Affects Versions: 3.0 Beta 1 
            Reporter: Gabriel Axel


When I try to map the result of a select statement to an immutable class, if a 
property name is the same as the column name I get an error for a missing 
setter.

Example:
 <resultMap type="test.Organization" id="organization">
        <constructor>
                <idArg column="organization_id" javaType="int"/>
                <arg column="name" javaType="String"/>
        </constructor>
</resultMap>

<select id="getOrganizations" resultMap="organization">
        <![CDATA[
                select organization_id, name from organizations
        ]]>
</select>

public class Organization {

        private final int id;
        private final String name;
        
        public Organization(Integer id, String name) {
                this.id = id;
                this.name = name;
        }

        // getters...
}

In the example above, the "id" field maps properly but I get a missing setter 
error for the "name" field, unless I rename the column in the select statement 
and in the result map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
For additional commands, e-mail: dev-h...@ibatis.apache.org

Reply via email to