You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Abdullah Kauchali <ab...@isanusi.com> on 2006/10/07 14:10:24 UTC
Arrays instead of java.util.List?
Does iBatis support resultsets as arrays or the population of beans that
have array properties instead of java.util.List?
>From the example doc:
<resultMap id="categoryResult" class="com.ibatis.example.Category"
groupBy="id">
<result property="id" column="CAT_ID"/>
<result property="description" column="CAT_DESCRIPTION"/>
<result property="productList" resultMap="ProductCategory.productResult"/>
</resultMap>
Can the property "productList" be an array?
I have a complex type as a Java Bean that I'd like to populate using the 1:M
ibatis facility and I cannot serialize a java.util.List - only array of
objects.
Any ideas?
Many thanks & kind regards,
A
RE: Arrays instead of java.util.List?
Posted by Abdullah Kauchali <ab...@isanusi.com>.
Hi Richard,
Web services and Lists (collections) are not good friends. :(
Ie. I cannot serialize a POJO if it contains a List property - because it
then becomes opaque to the WSDL.
> -----Original Message-----
> From: Richard Yee [mailto:ryee@cruzio.com]
> Sent: Sunday, October 08, 2006 5:13 AM
> To: user-java@ibatis.apache.org
> Subject: Re: Arrays instead of java.util.List?
>
> Abdullah,
> Why do you want to use Arrays[]? Lists are better because they can grow
> and can always be converted into an array.
>
> -Richard
>
> Abdullah Kauchali wrote:
> > Hi Larry,
> >
> > Yup, I can do that. But how can I make iBatis' internal 1:M feature
> > populate arrays of POJO's instead of java.util.List?
> >
> > What's the best way of doing that?
> >
> > Regards,
> >
> > A
> >
> >
> >
> >
> >
> >
> >> -----Original Message-----
> >> From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On
> Behalf
> >> Of Larry Meadors
> >> Sent: Saturday, October 07, 2006 7:12 PM
> >> To: user-java@ibatis.apache.org
> >> Subject: Re: Arrays instead of java.util.List?
> >>
> >> Nope, but you can do this easy enough:
> >>
> >> return (YourType[])queryForList("blah.query", parms).toArray(new
> >> YourType[0]);
> >>
> >> Larry
> >>
> >> On 10/7/06, Abdullah Kauchali <ab...@isanusi.com> wrote:
> >>
> >>> Abdullah Kauchali:
> >>>
> >>>> I have a complex type as a Java Bean that I'd like to populate using
> >>>>
> >> the
> >>
> >>>> 1:M
> >>>> ibatis facility and I cannot serialize a java.util.List - only array
> >>>>
> >> of
> >>
> >>>> objects.
> >>>>
> >>> Complex type as in a web services complex type.
> >>>
> >>>
> >>>
> >
> >
> >
Re: Arrays instead of java.util.List?
Posted by Richard Yee <ry...@cruzio.com>.
Abdullah,
Why do you want to use Arrays[]? Lists are better because they can grow
and can always be converted into an array.
-Richard
Abdullah Kauchali wrote:
> Hi Larry,
>
> Yup, I can do that. But how can I make iBatis' internal 1:M feature
> populate arrays of POJO's instead of java.util.List?
>
> What's the best way of doing that?
>
> Regards,
>
> A
>
>
>
>
>
>
>> -----Original Message-----
>> From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf
>> Of Larry Meadors
>> Sent: Saturday, October 07, 2006 7:12 PM
>> To: user-java@ibatis.apache.org
>> Subject: Re: Arrays instead of java.util.List?
>>
>> Nope, but you can do this easy enough:
>>
>> return (YourType[])queryForList("blah.query", parms).toArray(new
>> YourType[0]);
>>
>> Larry
>>
>> On 10/7/06, Abdullah Kauchali <ab...@isanusi.com> wrote:
>>
>>> Abdullah Kauchali:
>>>
>>>> I have a complex type as a Java Bean that I'd like to populate using
>>>>
>> the
>>
>>>> 1:M
>>>> ibatis facility and I cannot serialize a java.util.List - only array
>>>>
>> of
>>
>>>> objects.
>>>>
>>> Complex type as in a web services complex type.
>>>
>>>
>>>
>
>
>
RE: Arrays instead of java.util.List?
Posted by Abdullah Kauchali <ab...@isanusi.com>.
Hi Larry,
Yup, I can do that. But how can I make iBatis' internal 1:M feature
populate arrays of POJO's instead of java.util.List?
What's the best way of doing that?
Regards,
A
> -----Original Message-----
> From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf
> Of Larry Meadors
> Sent: Saturday, October 07, 2006 7:12 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Arrays instead of java.util.List?
>
> Nope, but you can do this easy enough:
>
> return (YourType[])queryForList("blah.query", parms).toArray(new
> YourType[0]);
>
> Larry
>
> On 10/7/06, Abdullah Kauchali <ab...@isanusi.com> wrote:
> >
> > Abdullah Kauchali:
> > > I have a complex type as a Java Bean that I'd like to populate using
> the
> > > 1:M
> > > ibatis facility and I cannot serialize a java.util.List - only array
> of
> > > objects.
> >
> > Complex type as in a web services complex type.
> >
> >
Re: Arrays instead of java.util.List?
Posted by Larry Meadors <lm...@apache.org>.
Nope, but you can do this easy enough:
return (YourType[])queryForList("blah.query", parms).toArray(new YourType[0]);
Larry
On 10/7/06, Abdullah Kauchali <ab...@isanusi.com> wrote:
>
> Abdullah Kauchali:
> > I have a complex type as a Java Bean that I'd like to populate using the
> > 1:M
> > ibatis facility and I cannot serialize a java.util.List - only array of
> > objects.
>
> Complex type as in a web services complex type.
>
>
RE: Arrays instead of java.util.List?
Posted by Abdullah Kauchali <ab...@isanusi.com>.
Abdullah Kauchali:
> I have a complex type as a Java Bean that I'd like to populate using the
> 1:M
> ibatis facility and I cannot serialize a java.util.List - only array of
> objects.
Complex type as in a web services complex type.