ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Martin <pmar...@adobe.com>
Subject Re: Using java.util.List as the parameterClass
Date Tue, 18 Sep 2007 14:43:56 GMT
Thanks for your reply.

I am actually trying to write an assembler for LiveCycle Data  
Services, which provides data management services.  These data  
management services can be consumed by a Flex client. The Assembler  
interface (http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/ 
lcdsjavadoc/) receives its parameters as a List, ideally I wanted to  
pass this straight through to my sqlmap.

I have it working at the moment, but my assembler is turning the the  
list in to a map (the key is the index of the item in the list),  
which allows me to do something like this:

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



On 18 Sep 2007, at 15:32, Brandon Goodin wrote:

> No, that is currently not possible. If you only ever want the first  
> index then just pass in the first index from your DAO. Not sure  
> what you are trying to accomplish but it looks like it would be  
> better handled in java and not the sqlmap. If you want to provide  
> more information about the context of your decision we might be  
> able to help in determining a good alternative. It may be possible  
> to do this in the future with iB3. But, i don't see it happening in  
> iB2.
>
> Brandon
>
> On 9/18/07, Peter Martin <pmartin@adobe.com> wrote:
> 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
>
>
>
>



Cheers
Peter.

-- 
Peter Martin
Technical Architect
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6108 m: +44 (0) 7825 032160

Adobe Systems Europe Limited | Registered office: 151 St. Vincent  
Street, Glasgow G2 5NJ | Company No. SC101089






Mime
View raw message