1) You don't need to use groupBy just because you now have a composite key. groupBy is for resolving N+1 select issues where you have 1:M or M:M relationships. Since I don't see a nested resultMap attribute in either of your result maps, I can only assume you don't need this.
2) Using composite column definitions is for passing multiple parameters to a sub-select, which you also don't appear to be using because there's no select attribute in your result map either.
So let's first clarify what exactly it is you're trying to do. Here's what we understand:
* You have two columns: sid and m_no
Here's the part we don't know:
* What are you trying to map them to?
>From your description it's unclear if you're trying to:
* Map two columns to two properties (use two properties and normal mappings)
* Map two columns to one property (use SQL concatenation and an alias)
* Map two columns to a complex property using a object graph navigation (use two result mappings and object.dot.notation)
* Map two columns to a complex property using a sub-select (use composite column mapping and the select attribute mapped to a second SQL statement)
* Map two columns to a complex collection using a join and repeating groups (use groupBy and a nested resultMap attribute to map to a second resultMap)
Let us know what it is you're trying to do...it's all possible.
Cheers,
Clinton
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.
