ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From araoko <olas...@gmail.com>
Subject problems with collection element
Date Tue, 08 Sep 2009 11:12:41 GMT

i have a problem with the collection element, i cant get it to populate
ArraList properties on my POJO.

i can instantiate the pojo using the constructor element but the collection
element did not work. the 
mapper configuration xml is below, and folowing it is my POJO

<mapper namespace="timetable.dao.TimeTableDAO">

<select id="selectPeriodSet" parameterType="String"
  select a.name as name,
  a.startTime as startTime,
  a.endTime as endTime,
  count(b.name) as maxPeriodCount,
  from periodSets as a join periodTemplates as b on a.name=b.name
  where a.name = #{name}

<select id="selectStartTimes" parameterType="String">
     select startTime from periodTemplates where name = #{name}

<select id="selectEndTimes" parameterType="String">
    select endTime from periodTemplates where name = #{name}

<resultMap type="PeriodSet" id="periodSetResultMap">

    <arg column="name" javaType="String" /> 
    <arg column="startTime" javaType="SchoolTime" jdbcType="INTEGER" /> 
    <arg column="endTime" javaType="SchoolTime" jdbcType="INTEGER" /> 
    <arg column="maxPeriodCount" javaType="int" /> 

  <collection property="startTimes" column="name" ofType="SchoolTime"
select="selectStartTimes" javaType="ArrayList" /> 

  <collection property="endTimes" column="name" ofType="SchoolTime"
select="selectEndTimes" javaType="ArrayList" /> 


public class PeriodSet {

             private String name;
	private SchoolTime startTime;
	private SchoolTime endTime;
	private Weekday[] days;
	private List<SchoolTime> startTimes;
	private List<SchoolTime> endTimes;
	public PeriodSet(String name, SchoolTime startTime, SchoolTime endTime,
Integer maxPeriodCount) {
		// constuctor body

//other methods

i created an typeHandler for the SchoolTime object too.

on inspecting the sql server logs, it showd that the select querry meant to
populate the properties are called but the size of the array list is still
zero instead of 8 as returned by the query when done manually.
what am i doing wrong?
View this message in context: http://www.nabble.com/problems-with-collection-element-tp25344158p25344158.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org

View raw message