ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chandler <a...@chandlerfamily.org.uk>
Subject Re: Group By for multiple column primary keys
Date Fri, 14 Oct 2005 21:43:52 GMT
On Friday 14 Oct 2005 21:12, Dan Bradley wrote:
> Here's a working example of a compound key from a project of mine:
I think I am missing some things to make sense of this ...

>
> <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>

what exactly has your classes got in them?  something like this?

public class account {
...
	public versionid getid();
}

public class versionid {
...
	public int getNumber() {
	...
	}

	public int getVersion() {
	...
	}
} 




>
> <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" />
> ...

What is in this select? and what does the property "accounts" mean in java 
terms?

Since I want to do a GroupBy clause, effectively on any changes to the 
"accounts" property
-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.

Mime
View raw message