ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Alexander <D.Alexan...@lse.ac.uk>
Subject Re: Can queryForMap(...) behaviour be mimicked in the SQL Map XML files?
Date Fri, 30 May 2008 09:02:11 GMT


> Can queryForMap(...) behaviour be expressed in the SQL Map XML files?

I guess the answer is "no" then.

Expect it wouldn't be too much work to add this as a feature though. 

In the way Complex Collection Properties (List or Collection of a business
object) can be loaded now (see, Developer Guide, page 36) one could imagine
Complex Map Properties beeing handled too. Would require some extra syntax
for the result element to specify the field to use as the Map's key and
(optionally) the Map value, perhaps:

class Department {
    Map employeeMap; // (Long employeeId, Employee employee)
    ...
}

<resultMap id="get-department-result" class="example.Department">
   <result property="employeeMap" column="DEPT_ID"
select="getEmployeesByDeptId" mapKey="employeeId"/>
   ...
</resultMap>

Would be a useful feature for me at least.

Cheers,
D.

-- 
View this message in context: http://www.nabble.com/Can-queryForMap%28...%29-behaviour-be-mimicked-in-the-SQL-Map-XML-files--tp17514856p17554512.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message