Is it possible to use complex properties in the groupBy of a resultMap?
I am processing this kind of result set:
+--------+--------+-----------+------------+------------+-------------+--------+
| planId | siteId | sectionId | positionId | bannerType | impressions |
clicks |
+--------+--------+-----------+------------+------------+-------------+--------+
| 91852 | 1006 | 2 | 2 | 30 | 1 |
0 |
| 90314 | 1006 | 2 | 2 | 30 | 2 |
0 |
| 86961 | 557 | 2 | 2 | 30 | 1 |
0 |
| 86961 | 557 | 2 | 1 | 36 | 34 |
0 |
| 86961 | 557 | 1 | 2 | 30 | 3 |
0 |
+--------+--------+-----------+------------+------------+-------------+--------+
using these resultMaps:
<resultMap id="getAdInventories" class="AdInventory">
<result property="id" resultMap="optimizationSpace.AdInventoryId" />
<result property="adStatistics"
resultMap="optimizationSpace.AdStatistic" />
</resultMap>
<resultMap id="AdStatistic" class="AdStatistic">
<result property="adId" resultMap="optimizationSpace.AdId" />
<result property="impressionCount" column="impressionCount" />
<result property="clickCount" column="clickCount" />
</resultMap>
<resultMap id="AdId" class="AdId">
<result property="campaignPlanId" column="campaignPlanId" />
</resultMap>
<resultMap id="AdInventoryId" class="AdInventoryId">
<result property="siteId" column="siteId" />
<result property="sectionId" column="sectionId" />
<result property="positionId" column="positionId" />
<result property="bannerType" column="bannerType" />
</resultMap>
Calling
List<AdInventory> result = executor.queryForList("getAdInventories",
parameters);
will produce following result:
[
AdInventory[{557,1,2,30} / 0 / 0.0 / 0.0 /
{90314=AdStatistic[90314 / 0 / 2],
86961=AdStatistic[86961 / 0 / 3],
91852=AdStatistic[91852 / 0 / 1]}
]
]
But expected result in my case will be:
[
AdInventory[{1006,2,2,30} / 0 / 0.0 / 0.0 /
{91852=AdStatistic[91852 / 0 / 1],
90314=AdStatistic[90314 / 0 / 2]}
],
AdInventory[{557,2,2,30} / 0 / 0.0 / 0.0 /
{86961=AdStatistic[86961 / 0 / 1]}
],
AdInventory[{557,2,1,30} / 0 / 0.0 / 0.0 /
{86961=AdStatistic[86961 / 0 / 34]}
],
AdInventory[{557,1,2,30} / 0 / 0.0 / 0.0 /
{86961=AdStatistic[86961 / 0 / 3]}
]
]
Any idea what I am doing wrong?
Petr
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org