Additional documentation for section 3.5.13 when explaining the groupBy
attribute
---------------------------------------------------------------------------------
Key: IBATISNET-208
URL: https://issues.apache.org/jira/browse/IBATISNET-208
Project: iBatis for .NET
Issue Type: Improvement
Components: DataMapper
Affects Versions: DataMapper 1.6
Environment: Documentation
Reporter: Bob Hanson
Fix For: DataMapper 1.6
IMHO the current documentation does not provide enough information about what
the groupBy attribute is doing. I suggest that additional documentation be
provided that shows an example of the data returned from the example query and
how the groupBy is applied to that data.
Something like...
Category Table
--------------
CAT_ID CAT_DESCRIPTION
1 Category1
2 Category2
3 Category3
4 Category4
Product Table
-------------
PRD_ID PRD_DESCRIPTION PRD_CAT_ID
1 Product1 1
2 Product2 1
3 Product3 null
4 Product4 2
5 Product5 2
6 Product6 3
The query:
select C.CAT_ID, C.CAT_DESCRIPTION, P.PRD_ID, P.PRD_DESCRIPTION
from CATEGORY C
left outer join PRODUCT P
on C.CAT_ID = P.PRD_CAT_ID
where CAT_ID = #value#
Returns:
C.CAT_ID C.CAT_DESCRIPTION P.PRD_ID P.PRD_DESCRIPTION
1 Category1 1 Product1
1 Category1 2 Product2
2 Category2 4 Product4
2 Category2 5 Product5
3 Category3 6 Product6
In the Category-result ResultMap, groupBy="Id" tells the mapper to only create
a single Category object for every row in the query result that shares the same
Id (mapped from CAT_ID).
Therefore in the example, even though the query returned 5 rows, only 3
Cateogry objects will be created since there are only three distinct CAT_IDs in
the query result.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.