Author: gbayon
Date: Tue Feb 20 10:15:35 2007
New Revision: 509696

URL: http://svn.apache.org/viewvc?view=rev&rev=509696
Log:
- Fix for IBATISNET-209 groupBy use with extends attribute

Modified:
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?view=diff&rev=509696&r1=509695&r2=509696
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs 
Tue Feb 20 10:15:35 2007
@@ -1886,6 +1886,20 @@
                             
resultMap.GroupByProperties.Add(superMap.GroupByProperties[i]);
                         }
                     }
+
+                    // Verify that that each groupBy element correspond to a 
class member
+                    // of one of result property
+                    for (int i = 0; i < resultMap.GroupByProperties.Count; i++)
+                    {
+                        string memberName = resultMap.GroupByProperties[i];
+                        if (!resultMap.Properties.Contains(memberName))
+                        {
+                            throw new ConfigurationException(
+                                string.Format(
+                                    "Could not configure ResultMap named 
\"{0}\". Check the groupBy attribute. Cause: there's no result property named 
\"{1}\".",
+                                    resultMap.Id, memberName));
+                        }
+                    }
                                }
                                _configScope.SqlMapper.AddResultMap( resultMap 
);
                        }

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs?view=diff&rev=509696&r1=509695&r2=509696
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
 Tue Feb 20 10:15:35 2007
@@ -263,7 +263,7 @@
                 for (int i = 0; i < _groupByProperties.Count; i++)
                 {
                     string memberName = GroupByProperties[i];
-                    if (!_properties.Contains(GroupByProperties[i]))
+                    if (!_properties.Contains(memberName))
                     {
                          throw new ConfigurationException(
                              string.Format(
@@ -271,7 +271,6 @@
                                  _id, memberName));
                     }
                 }
-               
             }
                        catch(Exception e)
                        {


Reply via email to