ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Martin <pmar...@adobe.com>
Subject Using java.util.List as the parameterClass
Date Tue, 18 Sep 2007 12:53:12 GMT
I want to pass in a List as a parameter class and select the first  
item from the list. I know it is possible to use the <iterate> tag,  
but is it possible to pull out a single item for a given index? For  
example, in the following select I to get the item at position 0:

    <select id="countPeopleWithSurname"  
parameterClass="java.util.List" resultClass="int">
       SELECT count(*) FROM person WHERE per_last_name = <item 0>
    </select>

Likewise in an insert I may want to pull out the different items:

	<insert id="insertPerson" parameterClass="person">
		INSERT INTO PERSON (PER_ID, PER_FIRST_NAME, PER_LAST_NAME,
		PER_BIRTH_DATE, PER_WEIGHT_KG, PER_HEIGHT_M) VALUES (<item 0>,
		<item 1>, <item 2>, <item 3>, <item 4>, <item 5>)
	</insert>

Thanks
Peter




Mime
View raw message