You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Alan Chandler <al...@chandlerfamily.org.uk> on 2006/02/18 19:13:28 UTC

GroupBy with simple properties

I have a simple class 

public class User {
	private String name;
	private List<String> roles;
//getters and setters
}

and want to populate  a list of these it with the equally simple query

SELECT name,role FROM users LEFT JOIN roles USING (name)

I want to have some form of result map like this.

	<resultMap id="full-user" class="user" groupBy="name" >
		<result property="name" column="name"/>
		<result property="roles" resultMap="User.role" />
	</resultMap>
	<resultMap id="role" class="string">
		<result property=? column="role" />
	</resultMap>


How do you define the property for the role column ?

It would be easy if the my roles List was something more complex than 
List<String>, but I can't find any indication in the docs of how to deal with 
this simple case


-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.

Re: GroupBy with simple properties

Posted by Salman Khattak <kh...@yahoo.com>.
Thanks Tarek. btw which guide are you refering to?
-- 
View this message in context: http://www.nabble.com/GroupBy-with-simple-properties-tf1147117.html#a5141522
Sent from the iBATIS - User - Java forum at Nabble.com.


Re: GroupBy with simple properties

Posted by Salman Khattak <kh...@yahoo.com>.
Any answers to this question?
-- 
View this message in context: http://www.nabble.com/GroupBy-with-simple-properties-tf1147117.html#a5137503
Sent from the iBATIS - User - Java forum at Nabble.com.