Unfortunately GroupBy result maps do not currently support the
constructor element.
On 5/15/07, Chick, Brian <[EMAIL PROTECTED]> wrote:
I'm trying to use the groupBy attribute in conjunction with a
constructor. When using the groupBy attribute with the default no-args
constructor, it works great. Having issues using it when specifing a
constructor. My resultmap that looks like this:
<resultMap id="ResultId" class="ResultClass" groupBy="TheUniqueId">
<constructor>
<argument argumentName="inUniqueId" column="ID"
dbType="Integer"/>
<argument argumentName="inValOne" column="VAL_ONE"
dbType="string"/>
<argument argumentName="inValTwo" column="VAL_TWO"
dbType="string"/>
</constructor>
<result property="TheUniqueId" column ="ID" dbType ="Integer"/>
<result property ="ChildObject"
resultMapping="Domain.DataAccess.SqlMaps.ChildMapping"/>
</resultMap>
Throws the following NullReferenceException:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="IBatisNet.DataMapper"
StackTrace:
at
IBatisNet.DataMapper.MappedStatements.BaseStrategy.GetUniqueKey(IResultM
ap resultMap, RequestScope request, IDataReader reader)
at
IBatisNet.DataMapper.MappedStatements.ResultStrategy.GroupByStrategy.Pro
cess(RequestScope request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.ResultStrategy.MapStrategy.Process
(RequestScope request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForList[T]
(RequestScope request, ISqlMapSession session, Object parameterObject,
IList`1 resultObject, RowDelegate`1 rowDelegate)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForLis
t[T](ISqlMapSession session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String
statementName, Object parameterObject)
at
Quad.App.DataAccess.IBatis.BaseDataSource.<>c__DisplayClass59`1.<QueryFo
rList>b__58()
. . .
Any ideas would be appreciated. Thanks.