Try reversing the order of the result map definitions. Is this the latest version?
Larry On 4/18/06, Eric Bauld <[EMAIL PROTECTED]> wrote: > I have been trying to get this to work for 2 days, every time iBATIS > loads the setVotes(List votes) method in BasicStakeholder the list that > is pass in is ALWAYS null no matter what changes I make. > > It may be worth noting I get the same result if I put <result > property="votes" resultMap="Stakeholder.votes"/> > to <result property="votes" resultMap="I can put anything here"/> And > get the same result. > > I have the following data from this query, there are votes so they > should be getting returned ???? > I debuged with a breakpoint on the setVotes() method and the > BasicStakeholder object was loaded with the user id and the weight, but > the list passed in was null, for the user with id of "3" and he has 4 votes. > > SELECT v.user_id AS databaseId, > uw.weight AS weight, > v.user_id AS userId, > i.instance_id AS instanceId, > v.requirement_id AS requirementId, > v.criteria_id AS criteriaId, > v.value AS voteValue > FROM vote v, user_weight uw, instance i > WHERE i.instance_id = 1 > AND i.instance_id = uw.instance_id > AND i.instance_id = v.instance_id > AND uw.user_id = v.user_id > > Returns > +------------+--------+--------+------------+---------------+------------+-----------+ > | databaseId | weight | userId | instanceId | requirementId | criteriaId > | voteValue | > +------------+--------+--------+------------+---------------+------------+-----------+ > | 3 | 5 | 3 | 1 | 1 | 1 > | 9 | > | 3 | 5 | 3 | 1 | 2 | 1 > | 3 | > | 3 | 5 | 3 | 1 | 3 | 1 > | 1 | > | 3 | 5 | 3 | 1 | 4 | 1 > | 4 | > | 4 | 9 | 4 | 1 | 1 | 1 > | 9 | > | 4 | 9 | 4 | 1 | 2 | 1 > | 3 | > +------------+--------+--------+------------+---------------+------------+-----------+ > > > --------------------SQL MAP--------------------------------- > <?xml version="1.0" encoding="UTF-8" ?> > > <!DOCTYPE sqlMap > PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" > "http://www.ibatis.com/dtd/sql-map-2.dtd"> > > <sqlMap namespace="Stakeholder"> > > <resultMap id="stakeMap" class="rp.object.baseImpl.BasicStakeholder" > groupBy="requirementId"> > <result property="databaseId" column="databaseId"/> > <result property="weight" column="weight"/> > <result property="votes" resultMap="Stakeholder.votes"/> > </resultMap> > > <resultMap id="votes" class="rp.object.baseImpl.BasicVote"> > <result property="userId" column="userId"/> > <result property="instanceId" column="instanceId"/> > <result property="requirementId" column="requirementId"/> > <result property="criteriaId" column="criteriaId"/> > <result property="voteValue" column="voteValue"/> > </resultMap> > > > <select id="getStakeholders" resultMap="stakeMap"> > SELECT v.user_id AS databaseId, > uw.weight AS weight, > v.user_id AS userId, > i.instance_id AS instanceId, > v.requirement_id AS requirementId, > v.criteria_id AS criteriaId, > v.value AS voteValue > FROM vote v, user_weight uw, instance i > WHERE i.instance_id = #value# > AND i.instance_id = uw.instance_id > AND i.instance_id = v.instance_id > AND uw.user_id = v.user_id > </select> > > </sqlMap> > > >
