ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michal Malecki" <misie...@poczta.onet.pl>
Subject Re: Incorrect usage of n+1 fix?
Date Thu, 06 Jan 2005 11:51:03 GMT
Incorrect usage of n+1 fix?Shouldn't groupBy="name" be rather in the quarterMap? It is there,
where the grouping happens.
Michal Malecki

  Following the threads on the mailing list archive I tried to use the n+1 fix but I get the
following from my query. 
  Below is the exception and the related items that I have defined. 
  It's interesting to note that if I don't try to execute getQuartersForServiceYear then it
works fine (doesn't complain about missing maps etc).

  Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no result map named monthMap
in this SqlMap.
  --- The error occurred in sqlMap.xml.
    <resultMap id="quarterMap" class="calendarQuarter">
      <result property="quarter" column="quarter"/>
      <result property="name" column="name"/>
      <result property="description" column="description"/>
      <result property="months" resultMap="monthMap"/>
    <resultMap id="monthMap" class="calendarMonth" groupBy="name">
      <result property="name" column="monthName"/>
      <result property="description" column="monthDescription"/>
      <result property="broadcastStartDate" column="broadcastStartDate"/>
      <result property="broadcastEndDate" column="broadcastEndDate"/>
    <select id="getQuartersForServiceYear" resultMap="quarterMap">
          distinct $serviceCode$QuarterNumber as quarter,
          $serviceCode$QuarterName as name,
          $serviceCode$QuarterDesc as description,
          $serviceCode$SeasonYear as year,
          $serviceCode$MonthName as monthName,
          $serviceCode$MonthDesc as monthDescription,
          min(broadcastDate) as broadcastStartDate,
          max(broadcastDate) as broadcastEndDate
      from BroadcastDate
      where $serviceCode$SeasonYear = #year#
      and $serviceCode$MonthName is not null
      group by
      order by broadcastStartDate

View raw message