Help!!  I am having problems getting my groupBy to work. My query brings back 5 
rows, but the businessEmployeesList collection is not populated for any of the 
business objects. Here is my mapping:  

<resultMap id="businessResult" class="business" groupBy="bus_Id">
    <result property=""  />  .................... <-- all properties for this 
table
</resultMap>

<resultMap id="empRoleResult" class="empRole" groupBy="emp_Id, bus_Id">
    <result property=""  />  ....................  <-- all properties for this 
table
</resultMap>

<resultMap id="busEmpRoleResult" class="business" extends="businessResult">
    <result property="businessEmployeesList" resultMap="Business.empRoleResult" 
/>
</resultMap>

<select id="getBusEmpRoleByIdNum" parameterClass="java.lang.String" 
resultMap="busEmpRoleResult">
SELECT *
FROM AIDDB2.BUSINESS AS A
INNER JOIN AIDDB2.ROLE AS B ON A.BUS_ID = B.BUS_ID
WHERE BUS_ID_NUM = #value#
</select>

I am using ArrayList list = 
(ArrayList)getSqlMapExecutor().queryForList("getBusEmpRoleByIdNum", 
idNumber.trim());  to get the data

When I debug this, it appears the businessEmployeesList collection is null, 
which would seem to make sense since it appears from the debug statements that 
the role is being built after the list is populated (I have debug statements in 
the constructors).  Where are the Role records going?  I can see they are being 
built, but the List I get back only seems to have the 5 business objects!  I 
have tried removing the groupBy on the businessResult map, adding it to the 
busEmpRoleResult map and every combination of the two, but no approach seems to 
work.  Does anybody have any suggestions?  Thanks!!  

[4/7/06 6:50:38:125 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Building Business
[4/7/06 6:50:38:125 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Adding new business list with null 
employees for [EMAIL PROTECTED]
[4/7/06 6:50:38:141 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Role - Building Role
[4/7/06 6:50:38:141 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Building Business
[4/7/06 6:50:38:141 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Adding new business list with null 
employees for [EMAIL PROTECTED]
[4/7/06 6:50:38:141 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Role - Building Role
[4/7/06 6:50:38:141 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Building Business
[4/7/06 6:50:38:141 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Adding new business list with null 
employees for [EMAIL PROTECTED]
[4/7/06 6:50:38:156 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Role - Building Role
[4/7/06 6:50:38:156 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Building Business
[4/7/06 6:50:38:156 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Business - Adding new business list with null 
employees for [EMAIL PROTECTED]
[4/7/06 6:50:38:156 CDT] 792fe35e SystemOut     O  * Servlet.Engine.Transports 
: 0 *  * DEBUG common.model.Role - Building Role

Reply via email to