ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Bibb <richard.b...@aimhedge.com>
Subject Populating a Pojo with two ArrayLists
Date Wed, 19 Aug 2009 10:09:30 GMT

I'm trying to populate a pojo with two array lists and my code doesn't do
what I intended

The pojo has two arrayLists as memebers one called 'dates' the other
'values'

The mapper XML file I have set up looks like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="com.aimhedge.trading.database.BackAdjFutureMapper">
	<resultMap id="futureMap" type="DataMap">
		<collection property="dates" javaType="ArrayList" ofType="Date">
			<id property="date" column="date" javaType="Date" jdbcType="DATE"/>
		</collection>
		<collection property="values" javaType="ArrayList" ofType="Double">
			<id property="value" column="value" javaType="Double" jdbcType="DOUBLE"/>
		</collection>
	</resultMap>
	<select id="selectBackAdjFuture" parameterType="BackAdjFuture"
resultMap="futureMap">
  		select date, value 
  		from back_adj_future
		where feed = #{feed}
		and instrument = #{instrument}
		and periodicity = #{periodicity}
		and field = #{field}
		and date <![CDATA[<]]> str_to_date('19980721','%Y%m%d')
		and date <![CDATA[>]]> str_to_date('19980701','%Y%m%d')
	</select>
</mapper>

When I run the code, instead of having both one array list populated with
dates and the other with values both seem to contain dates. Can anyone point
out where I am going wrong? I'm new to iBatis and my use of collections is
probably wrong. One of my issues is that the value field isn't unique so
setting it as an id is probably wrong.
-- 
View this message in context: http://www.nabble.com/Populating-a-Pojo-with-two-ArrayLists-tp25041366p25041366.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


Mime
View raw message