Here's a working example of a compound key from a project of mine:
<sqlMap namespace="Account">
<resultMap id="account-result" class="account">
<result property="id.number" column="id" />
<result property="id.version" column="version" />
...
<select id="getAccountByVersionId" resultMap="account-result"
parameterClass="versionId">
<![CDATA[
select * from accounts
where id=#number# and version=#version#
and deleted=0
]]>
</select>
<sqlMap namespace="Organization">
<resultMap id="organization-result" class="organization">
<result property="id.number" column="id" />
<result property="id.version" column="version" />
<result property="accounts" column="{id=id,version=version}"
select="getAccountsForOrganizationId" />
...
On 10/14/05, Alan Chandler <[EMAIL PROTECTED]> wrote:
> I have a table in which I have just add to change it from one to two columns
> making up the primary key. (before it was column "sid", now I also need
> "m_no")
>
> This is how I used to do it
>
> <resultMap id="family-list" class="family"
> groupBy="marriage.spouse.id" >
> <result property="marriage.spouse.id" column="sid" />
> <result property="marriage.m_no" column="m_no" />
> ...
>
> I think the manual implies this - is it correct?
>
> <resultMap id="family-list" class="family"
> groupBy="a_key" >
> <result property=a_key column="{marriage.spouse.id = sid,
> marriage.m_no
> =m_no}" />
>
> ... (ignoring mail wordwrap issues)
>
>
> --
> Alan Chandler
> http://www.chandlerfamily.org.uk
> Open Source. It's the difference between trust and antitrust.
>