ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Kahn <jkahn_...@yahoo.com>
Subject Re: Strongly Typed Collections?
Date Mon, 10 Dec 2007 23:15:11 GMT
Thanks Larry, that answers my question.  Since my collection implements List, I simply had
the setter take an argument of type List instead (easy I know, but I was curious if there
was a practice for doing otherwise).

-Josh

----- Original Message ----
From: Larry Meadors <lmeadors@apache.org>
To: user-java@ibatis.apache.org
Sent: Monday, December 10, 2007 4:29:03 PM
Subject: Re: Strongly Typed Collections?


There is currently no way to configure iBATIS to return a different
type of List.

Larry

On Dec 10, 2007 3:15 PM, Joshua Kahn <jkahn_117@yahoo.com> wrote:
>
> No, this is a Java question.
>
> I did do that:
>
> In sql-map-config.xml:
> <typeAlias alias="MyModelList" type="mypackage.MyModelList"/>
>
> Any other thoughts?  It still seems to want to return a List.
>
> Thanks,
> Josh
>
>
>
> ----- Original Message ----
> From: Gilles Bayon <ibatis.net@gmail.com>
> To: user-java@ibatis.apache.org
> Sent: Monday, December 10, 2007 3:02:01 PM
> Subject: Re: Strongly Typed Collections?
>
>  I I think you are in the wrong list, you must subscribe/post to the
 .net
> list.
> you must use the listClass attribut by setting it as the type alias
 to the
> MyModelList type
>
> Cheer,
> Gilles
>
>  On Dec 10, 2007 9:21 PM, Joshua Kahn <jkahn_117@yahoo.com> wrote:
> > Forgive me if this is obvious, but I am an iBatis newbie.
> >
> > In my model object, I have a property that is a custom collection:
> >    MyModel
> >       |-- MyModelList (collection of MyModel objects -- implements
 List,
> extends ArrayList)
> >
> > In my SqlMap, I have defined a separate select query to retrieve
 this
> collection, which returns a List of MyModel objects.  This, however,
 causes
> an IllegalArgumentException at runtime as the setter is expecting a
> MyModelList and not a List.  There is an easy way to code around
 this, but I
> am curious if there is a best practice for implementing/mapping this
 in
> iBatis.
> >
> > How does iBatis handle strongly typed custom collections? (I did
 find a
> reference to a SqlMap property "listClass" but it seems to have been
> deprecated in version 2).
> >
> > Thanks,
> > Josh
> >
> >
> >
> >
> >
> >
> >
>
 ____________________________________________________________________________________
> > Never miss a thing.  Make Yahoo your home page.
> > http://www.yahoo.com/r/hs
> >
>
>
>
> --
> Cheers,
> Gilles
>
> Join my network on LinkedIn
> http://www.linkedin.com/in/sellig
>
>
>  ________________________________
> Never miss a thing. Make Yahoo your homepage.





      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



Mime
View raw message