ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent <vinc...@xaymaca.com>
Subject Re: ArrayList as parameter
Date Mon, 28 Mar 2005 14:34:35 GMT
That that you could add a "utility field" to your bean
to handle that sorting property :). Mine deciding point is more
based on laziness. 4 variables or less to pass? Then I use a Map, 
anything over that, I use a bean. Not very scientific I know.

John Fereira wrote:
> At 09:12 AM 3/19/2005 -0700, Clinton Begin wrote:
>> This is an inappropriate use of a list.  A list is good for objects of
>> the same (or at least similar!) type.  In your case the list contains
>> completely different data.
>> You should use a Map for this, or better yet, a JavaBean.
> One might wonder when it's better to use a Map or a JavaBean.  I've 
> found that I want to use a Map when I want to pass a parameter that I 
> might not want to put in a bean I'm using.  For example, I might have a 
> patrons bean with several fields (patronsid, firstname, lastname, 
> emailaddress).  When I query the database for a single row using the 
> bean for the parameter object works fine.  However, I might want a list 
> of all patrons which have a specified string in the email address and I 
> want the list sorted by lastname or emailaddress.  Since the bean 
> doesn't have a sort order field I would use a Map for the parameter  
> object so that I could use an "ORDER BY #sortorder# " in the map.
> John Fereira
> jaf30@cornell.edu
> Ithaca, NY

Plato is my friend, Aristotle is my friend, but my greatest friend is truth.
- Isaac Newton

View raw message