ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: New to iBatis
Date Fri, 15 Jun 2007 21:20:38 GMT
You could even go so far as to say...

List names = new ArrayList();
names.add("moive one");
names.add("movie two");

Map params = new HashMap();

params.put("startDate", startDate);
params.put("movieNames", names);

SELECT movie_name
FROM movies
  release_date between #startDate# AND #endDate#
  <iterate property="movieNames" prepend="AND movie_name IN" open="("

You will have to refer to the correct syntax for the iterate tag.  I just
threw that up there off the top of my head.  Really you can accomplish just
about anything you need with a Map parameter.


On 6/15/07, Christopher.Mathrusse@sybase.com <
Christopher.Mathrusse@sybase.com> wrote:
>  Yes, you can do that or you can pass in a java.util.Map that contains
> your values. This is probably the simpler.
> java.util.Map map = new java.util.Hashmap();
> map.put("value1", date1);
> map.put("value2", date2);
>  ------------------------------
> *From:* vinays84 <vinays84@hotmail.com> [mailto:vinays84 <
> vinays84@hotmail.com>]
> *Sent:* Friday, June 15, 2007 12:12 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: New to iBatis
> Just as only a single object can be passed in for the return class, can
> only
> a single object be passed in for a parameter class? Consider the query:
> SELECT movie_name FROM movies WHERE release_date between #value1# AND
> #value2#
> Could I pass in two dates as parameters, or would I have to create a class
> containing value1 and value2 as properties. (this class obviously would be
> created solely for this one query).
> --
> View this message in context:
> http://www.nabble.com/New-to-iBatis-tf3922862.html#a11145189
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message