You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Harvey Kim <ca...@fastmail.fm> on 2008/06/11 19:50:18 UTC

groupBy list always contains empty row.

Java class:
-----------
class SomeClassDTO
{
  blah, blah, blah attributes ...
  List someGroupByList = null;
}


Ibatis Mapping and select statement
-----------------------------------
<resultMap id="someMap" groupBy="someId" class="SomeClassDTO">
        <result property="someId" ..../>
	<result property="someGroupByList" resultMap="someGroupByList.someGroupByListMap"/>
</resultMap>

<select id="selectSomething" resultMap="someMap" >
SELECT blah blah blah attributes, joinTable.* 
FROM someTable
LEFT JOIN joinTable
ON (joinTable.someId = 123456789)
WHERE someTable.someId = 123456789


If 123456789 does NOT exist in "joinTable", shouldn't "someGroupByList"
stay null?  It always seems to have list size of 1 even if the join
entry does not exist.  Was this by design or is there something I'm not
doing wrong.  I realize the solution is to not use groupBy and populate
the list indepedently but if there is a magic flag, I'd appreciate it.

thanks,

-Harvey

-- 
http://www.fastmail.fm - Email service worth paying for. Try it for free