This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Description
What version of the MyBatis are you using?
MyBatis 3.0.6 java
Please describe the problem. Unit tests are best!
It is not possible to create immutable domain objects i.e. through constructor
initialization the same way you can create mutable objects i.e. through setters
when a query includes associations and/or collections.
What is the expected output? What do you see instead?
To create truly immutable domain objects on should be able to turn this
<resultMap id="objectBuilderResultMap" type="ObjectBuilder">
<id property="id" column="id" />
<association property="o1" resultMap="o1ResultMap"/>
<collection property="o2List" ofType="Object2" resultMap="o2ResultMap"/>
</resultMap>
into this:
<resultMap id="domainObjectResultMap" type="DomainObject">
<idArg column="id" javaType="Long" />
<arg resultMap="o1ResultMap" javaType="Object1" />
<arg resultMap="o2ResultMap" javaType="List" />
</resultMap>
Please provide any additional information below.
One workaround, which is clean but involves a lot of developer overhead is to
create a builder object for each domain object, initialize the builder through
its setter methods, then let the builder return an immutable domain object via
a build() method for example.
Another workaround is to use the "select" attribute in the "arg" element:
<arg resultMap="o1ResultMap" javaType="Object1" select="selectId" />
Original issue reported on code.google.com by jms.cer...@gmail.com
on 24 Dec 2011 at 11:42