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 Fred Janon <fj...@gmail.com> on 2009/07/02 05:58:44 UTC

queryForObject/queryForList where is the documentation for the "Object parameter"?

Sorry for the basic question: how to write a query with mutiple parameters?
I am reading the iBatis in Action book, browsing the distribution, the wiki,
the Javadoc and I can't find documentation or examples for the different
forms of the parameter for queryForObject or queryForList

SqlMapExecutor

java.util.List *queryForList*(java.lang.String id,
                            java.lang.Object parameterObject,
                            int skip,
                            int max)
                            throws java.sql.SQLException

Executes a mapped SQL SELECT statement that returns data to populate a
number of result objects within a certain range.

The parameter object is generally used to supply the input data for the
WHERE clause parameter(s) of the SELECT statement.

 *Parameters:* id - The name of the statement to execute. parameterObject -
The parameter object (e.g. JavaBean, Map, XML etc.). *<<< Where in the doc
or the book is that described in more details?*
How do I pass several parameters to queryForList like for example name,
beginsearchdate, beginlastdate?

I see details for the resultMap, nothing but only exmaples with one input
parameter. I started looking in the code, but it's taking too much time
now...

Thanks

Fred

Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

Posted by Larry Meadors <la...@gmail.com>.
It's about specialization: The core idea with ibatis is mapping sql to
java objects, and there are tools that do json and xml far better than
ibatis did, so we'll focus on what we do well, and let those tools do
what they do well.

It will be interesting to see some integration side projects that do
things like sql-xml or sql-json with other tools like XStream or
JSON-lib.

Larry


On Thu, Jul 2, 2009 at 9:55 PM, Fred Janon<fj...@gmail.com> wrote:
> That's too bad. One more thing to do in the code. I thought that JSON and
> XML support would be really good to implement RESTful web services. Is there
> a specific reason for taking it out?
>
> Fred
>
> On Thu, Jul 2, 2009 at 21:34, Larry Meadors <la...@gmail.com> wrote:
>>
>> FYI: XML parameters and results are on the way out with ibatis 3.
>>
>> Larry
>>
>>
>> On Thu, Jul 2, 2009 at 2:06 AM, meindert<me...@eduflex.com> wrote:
>> > Hi Fred,
>> >
>> >
>> >
>> > The XML parameter object is quite interesting, it doesn’t look like
>> > ibatis
>> > can handle a ‘XML object’ the same way as it can return a XML string
>> > object;
>> >
>> > http://www.mail-archive.com/user-java@ibatis.apache.org/msg13636
>> >
>> >
>> >
>> > Just a note, the XML returned from ibatis is quite limited, I personally
>> > use
>> > XStream to serialize java beans  to XML (or JSON) and back to java beans
>> >
>> >
>> >
>> > meindert
>> >
>> > From: Fred Janon [mailto:fjanon@gmail.com]
>> > Sent: 02 July 2009 09:53 AM
>> > To: user-java@ibatis.apache.org
>> > Subject: Re: queryForObject/queryForList where is the documentation for
>> > the
>> > "Object parameter"?
>> >
>> >
>> >
>> > Thanks. It seems though that there are more facets to it, like XML which
>> > is
>> > particularly interesting for RESTful services.
>> >
>> > Fred
>> >
>> > On Thu, Jul 2, 2009 at 14:49, meindert <me...@eduflex.com> wrote:
>> >
>> > You can only have one input Object. For simple parameters I use a Map
>> > object;
>> >
>> > As larry said, the GRD (Get R' Done) approach to do this:
>> >
>> > Map<String, Object> param = new HashMap<String, Object>();
>> >
>> > param.put("id", yourInt);
>> >
>> > param.put("description", yourString);
>> >
>> >
>> >
>> > In you sqlmap you can revere to these parameters like #id# and
>> > #description#, or $id$ and $description$ if you want to do a literary
>> > replacement.
>> >
>> >
>> >
>> >
>> >
>> > From: Fred Janon [mailto:fjanon@gmail.com]
>> > Sent: 02 July 2009 05:59 AM
>> > To: user-java@ibatis.apache.org
>> > Subject: queryForObject/queryForList where is the documentation for the
>> > "Object parameter"?
>> >
>> >
>> >
>> > Sorry for the basic question: how to write a query with mutiple
>> > parameters?
>> > I am reading the iBatis in Action book, browsing the distribution, the
>> > wiki,
>> > the Javadoc and I can't find documentation or examples for the different
>> > forms of the parameter for queryForObject or queryForList
>> >
>> > java.util.List queryForList(java.lang.String id,
>> >
>> >                             java.lang.Object parameterObject,
>> >
>> >                             int skip,
>> >
>> >                             int max)
>> >
>> >                             throws java.sql.SQLException
>> >
>> > Executes a mapped SQL SELECT statement that returns data to populate a
>> > number of result objects within a certain range.
>> >
>> > The parameter object is generally used to supply the input data for the
>> > WHERE clause parameter(s) of the SELECT statement.
>> >
>> > Parameters:
>> >
>> > id - The name of the statement to execute.
>> >
>> > parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
>> > <<<
>> > Where in the doc or the book is that described in more details?
>> >
>> > How do I pass several parameters to queryForList like for example name,
>> > beginsearchdate, beginlastdate?
>> >
>> > I see details for the resultMap, nothing but only exmaples with one
>> > input
>> > parameter. I started looking in the code, but it's taking too much time
>> > now...
>> >
>> > Thanks
>> >
>> > Fred
>> >
>> > Checked by AVG - www.avg.com
>> > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date:
>> > 06/30/09
>> > 11:37:00
>> >
>> >
>> >
>> > Checked by AVG - www.avg.com
>> > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date:
>> > 07/01/09
>> > 18:07:00
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

Posted by Fred Janon <fj...@gmail.com>.
That's too bad. One more thing to do in the code. I thought that JSON and
XML support would be really good to implement RESTful web services. Is there
a specific reason for taking it out?

Fred

On Thu, Jul 2, 2009 at 21:34, Larry Meadors <la...@gmail.com> wrote:

> FYI: XML parameters and results are on the way out with ibatis 3.
>
> Larry
>
>
> On Thu, Jul 2, 2009 at 2:06 AM, meindert<me...@eduflex.com> wrote:
> > Hi Fred,
> >
> >
> >
> > The XML parameter object is quite interesting, it doesn’t look like
> ibatis
> > can handle a ‘XML object’ the same way as it can return a XML string
> object;
> >
> > http://www.mail-archive.com/user-java@ibatis.apache.org/msg13636
> >
> >
> >
> > Just a note, the XML returned from ibatis is quite limited, I personally
> use
> > XStream to serialize java beans  to XML (or JSON) and back to java beans
> >
> >
> >
> > meindert
> >
> > From: Fred Janon [mailto:fjanon@gmail.com]
> > Sent: 02 July 2009 09:53 AM
> > To: user-java@ibatis.apache.org
> > Subject: Re: queryForObject/queryForList where is the documentation for
> the
> > "Object parameter"?
> >
> >
> >
> > Thanks. It seems though that there are more facets to it, like XML which
> is
> > particularly interesting for RESTful services.
> >
> > Fred
> >
> > On Thu, Jul 2, 2009 at 14:49, meindert <me...@eduflex.com> wrote:
> >
> > You can only have one input Object. For simple parameters I use a Map
> > object;
> >
> > As larry said, the GRD (Get R' Done) approach to do this:
> >
> > Map<String, Object> param = new HashMap<String, Object>();
> >
> > param.put("id", yourInt);
> >
> > param.put("description", yourString);
> >
> >
> >
> > In you sqlmap you can revere to these parameters like #id# and
> > #description#, or $id$ and $description$ if you want to do a literary
> > replacement.
> >
> >
> >
> >
> >
> > From: Fred Janon [mailto:fjanon@gmail.com]
> > Sent: 02 July 2009 05:59 AM
> > To: user-java@ibatis.apache.org
> > Subject: queryForObject/queryForList where is the documentation for the
> > "Object parameter"?
> >
> >
> >
> > Sorry for the basic question: how to write a query with mutiple
> parameters?
> > I am reading the iBatis in Action book, browsing the distribution, the
> wiki,
> > the Javadoc and I can't find documentation or examples for the different
> > forms of the parameter for queryForObject or queryForList
> >
> > java.util.List queryForList(java.lang.String id,
> >
> >                             java.lang.Object parameterObject,
> >
> >                             int skip,
> >
> >                             int max)
> >
> >                             throws java.sql.SQLException
> >
> > Executes a mapped SQL SELECT statement that returns data to populate a
> > number of result objects within a certain range.
> >
> > The parameter object is generally used to supply the input data for the
> > WHERE clause parameter(s) of the SELECT statement.
> >
> > Parameters:
> >
> > id - The name of the statement to execute.
> >
> > parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
> <<<
> > Where in the doc or the book is that described in more details?
> >
> > How do I pass several parameters to queryForList like for example name,
> > beginsearchdate, beginlastdate?
> >
> > I see details for the resultMap, nothing but only exmaples with one input
> > parameter. I started looking in the code, but it's taking too much time
> > now...
> >
> > Thanks
> >
> > Fred
> >
> > Checked by AVG - www.avg.com
> > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09
> > 11:37:00
> >
> >
> >
> > Checked by AVG - www.avg.com
> > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09
> > 18:07:00
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

Posted by Larry Meadors <la...@gmail.com>.
FYI: XML parameters and results are on the way out with ibatis 3.

Larry


On Thu, Jul 2, 2009 at 2:06 AM, meindert<me...@eduflex.com> wrote:
> Hi Fred,
>
>
>
> The XML parameter object is quite interesting, it doesn’t look like ibatis
> can handle a ‘XML object’ the same way as it can return a XML string object;
>
> http://www.mail-archive.com/user-java@ibatis.apache.org/msg13636
>
>
>
> Just a note, the XML returned from ibatis is quite limited, I personally use
> XStream to serialize java beans  to XML (or JSON) and back to java beans
>
>
>
> meindert
>
> From: Fred Janon [mailto:fjanon@gmail.com]
> Sent: 02 July 2009 09:53 AM
> To: user-java@ibatis.apache.org
> Subject: Re: queryForObject/queryForList where is the documentation for the
> "Object parameter"?
>
>
>
> Thanks. It seems though that there are more facets to it, like XML which is
> particularly interesting for RESTful services.
>
> Fred
>
> On Thu, Jul 2, 2009 at 14:49, meindert <me...@eduflex.com> wrote:
>
> You can only have one input Object. For simple parameters I use a Map
> object;
>
> As larry said, the GRD (Get R' Done) approach to do this:
>
> Map<String, Object> param = new HashMap<String, Object>();
>
> param.put("id", yourInt);
>
> param.put("description", yourString);
>
>
>
> In you sqlmap you can revere to these parameters like #id# and
> #description#, or $id$ and $description$ if you want to do a literary
> replacement.
>
>
>
>
>
> From: Fred Janon [mailto:fjanon@gmail.com]
> Sent: 02 July 2009 05:59 AM
> To: user-java@ibatis.apache.org
> Subject: queryForObject/queryForList where is the documentation for the
> "Object parameter"?
>
>
>
> Sorry for the basic question: how to write a query with mutiple parameters?
> I am reading the iBatis in Action book, browsing the distribution, the wiki,
> the Javadoc and I can't find documentation or examples for the different
> forms of the parameter for queryForObject or queryForList
>
> java.util.List queryForList(java.lang.String id,
>
>                             java.lang.Object parameterObject,
>
>                             int skip,
>
>                             int max)
>
>                             throws java.sql.SQLException
>
> Executes a mapped SQL SELECT statement that returns data to populate a
> number of result objects within a certain range.
>
> The parameter object is generally used to supply the input data for the
> WHERE clause parameter(s) of the SELECT statement.
>
> Parameters:
>
> id - The name of the statement to execute.
>
> parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<<
> Where in the doc or the book is that described in more details?
>
> How do I pass several parameters to queryForList like for example name,
> beginsearchdate, beginlastdate?
>
> I see details for the resultMap, nothing but only exmaples with one input
> parameter. I started looking in the code, but it's taking too much time
> now...
>
> Thanks
>
> Fred
>
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09
> 11:37:00
>
>
>
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09
> 18:07:00

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


RE: queryForObject/queryForList where is the documentation for the "Object parameter"?

Posted by meindert <me...@eduflex.com>.
Hi Fred,

 

The XML parameter object is quite interesting, it doesn't look like ibatis
can handle a 'XML object' the same way as it can return a XML string object;

http://www.mail-archive.com/user-java@ibatis.apache.org/msg13636 

 

Just a note, the XML returned from ibatis is quite limited, I personally use
XStream to serialize java beans  to XML (or JSON) and back to java beans

 

meindert

From: Fred Janon [mailto:fjanon@gmail.com] 
Sent: 02 July 2009 09:53 AM
To: user-java@ibatis.apache.org
Subject: Re: queryForObject/queryForList where is the documentation for the
"Object parameter"?

 

Thanks. It seems though that there are more facets to it, like XML which is
particularly interesting for RESTful services.

Fred



On Thu, Jul 2, 2009 at 14:49, meindert <me...@eduflex.com> wrote:

You can only have one input Object. For simple parameters I use a Map
object;

As larry said, the GRD (Get R' Done) approach to do this:

Map<String, Object> param = new HashMap<String, Object>(); 

param.put("id", yourInt); 

param.put("description", yourString);

 

In you sqlmap you can revere to these parameters like #id# and
#description#, or $id$ and $description$ if you want to do a literary
replacement.

 

 

From: Fred Janon [mailto:fjanon@gmail.com] 
Sent: 02 July 2009 05:59 AM
To: user-java@ibatis.apache.org
Subject: queryForObject/queryForList where is the documentation for the
"Object parameter"?

 

Sorry for the basic question: how to write a query with mutiple parameters?
I am reading the iBatis in Action book, browsing the distribution, the wiki,
the Javadoc and I can't find documentation or examples for the different
forms of the parameter for queryForObject or queryForList

java.util.List queryForList(java.lang.String id,
                            java.lang.Object parameterObject,
                            int skip,
                            int max)
                            throws java.sql.SQLException

Executes a mapped SQL SELECT statement that returns data to populate a
number of result objects within a certain range. 

The parameter object is generally used to supply the input data for the
WHERE clause parameter(s) of the SELECT statement. 

Parameters: 

id - The name of the statement to execute. 

parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<<
Where in the doc or the book is that described in more details?

How do I pass several parameters to queryForList like for example name,
beginsearchdate, beginlastdate?

I see details for the resultMap, nothing but only exmaples with one input
parameter. I started looking in the code, but it's taking too much time
now...

Thanks

Fred

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09
11:37:00

 

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09
18:07:00


Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

Posted by Fred Janon <fj...@gmail.com>.
Thanks. It seems though that there are more facets to it, like XML which is
particularly interesting for RESTful services.

Fred


On Thu, Jul 2, 2009 at 14:49, meindert <me...@eduflex.com> wrote:

>  You can only have one input *Object. *For simple parameters I use a Map
> object;
>
> As larry said, the GRD (Get R' Done) approach to do this:
>
> Map<String, Object> param = new HashMap<String, Object>();
>
> param.put("id", yourInt);
>
> param.put("description", yourString);
>
>
>
> In you sqlmap you can revere to these parameters like #id# and
> #description#, or $id$ and $description$ if you want to do a literary
> replacement.
>
>
>
>
>
> *From:* Fred Janon [mailto:fjanon@gmail.com]
> *Sent:* 02 July 2009 05:59 AM
> *To:* user-java@ibatis.apache.org
> *Subject:* queryForObject/queryForList where is the documentation for the
> "Object parameter"?
>
>
>
> Sorry for the basic question: how to write a query with mutiple parameters?
> I am reading the iBatis in Action book, browsing the distribution, the wiki,
> the Javadoc and I can't find documentation or examples for the different
> forms of the parameter for queryForObject or queryForList
>
> java.util.List *queryForList*(java.lang.String id,
>
>                             java.lang.Object parameterObject,
>
>                             int skip,
>
>                             int max)
>
>                             throws java.sql.SQLException
>
> Executes a mapped SQL SELECT statement that returns data to populate a
> number of result objects within a certain range.
>
> The parameter object is generally used to supply the input data for the
> WHERE clause parameter(s) of the SELECT statement.
>
> *Parameters:*
>
> id - The name of the statement to execute.
>
> parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). *<<<
> Where in the doc or the book is that described in more details?*
>
> How do I pass several parameters to queryForList like for example name,
> beginsearchdate, beginlastdate?
>
> I see details for the resultMap, nothing but only exmaples with one input
> parameter. I started looking in the code, but it's taking too much time
> now...
>
> Thanks
>
> Fred
>
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09
> 11:37:00
>

RE: queryForObject/queryForList where is the documentation for the "Object parameter"?

Posted by meindert <me...@eduflex.com>.
You can only have one input Object. For simple parameters I use a Map
object;

As larry said, the GRD (Get R' Done) approach to do this:

Map<String, Object> param = new HashMap<String, Object>(); 

param.put("id", yourInt); 

param.put("description", yourString);

 

In you sqlmap you can revere to these parameters like #id# and
#description#, or $id$ and $description$ if you want to do a literary
replacement.

 

 

From: Fred Janon [mailto:fjanon@gmail.com] 
Sent: 02 July 2009 05:59 AM
To: user-java@ibatis.apache.org
Subject: queryForObject/queryForList where is the documentation for the
"Object parameter"?

 

Sorry for the basic question: how to write a query with mutiple parameters?
I am reading the iBatis in Action book, browsing the distribution, the wiki,
the Javadoc and I can't find documentation or examples for the different
forms of the parameter for queryForObject or queryForList

java.util.List queryForList(java.lang.String id,
                            java.lang.Object parameterObject,
                            int skip,
                            int max)
                            throws java.sql.SQLException

Executes a mapped SQL SELECT statement that returns data to populate a
number of result objects within a certain range. 

The parameter object is generally used to supply the input data for the
WHERE clause parameter(s) of the SELECT statement. 

Parameters: 

id - The name of the statement to execute. 

parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<<
Where in the doc or the book is that described in more details?

How do I pass several parameters to queryForList like for example name,
beginsearchdate, beginlastdate?

I see details for the resultMap, nothing but only exmaples with one input
parameter. I started looking in the code, but it's taking too much time
now...

Thanks

Fred

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09
11:37:00