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 Daan de Wit <d....@wis.nl> on 2006/01/04 17:18:15 UTC

select statement without resultmap

Hi,

 

Today I found myself stuck with a very weird problem. A queryForList
returned an empty list while executing exactly the same query in the SQL
Query Analyzer returned one result. I thought that maybe the SQL
Profiler would be more informative about the problem, but query and the
parameter were both the same as I used in the Query Analayzer.

It turned out that I forgot to set a resultmap for the select-statement.
Wouldn't it be better to throw an exception if no resultmap or
resultclass is found for a select? Or maybe the xml could be changed to
something like this:

<select id="mySelect" resultType="map" resultId="myResultMap">

I realize that the names I chose for the attributes are not that good,
but they are good enough to get the idea.

 

Regards,

Daan


Re: select statement without resultmap

Posted by Larry Meadors <lm...@apache.org>.
IIRC, the problem was compatibility - there are people who use <select
/> to execute stored procedures that update data, and do not need
returned data, so they leave them blank.

Making one or the other required (aside: I did make this change in
1.x, and did it in the builder, not the DTD) would break their
applications.

IMO, 3.x should make this behavior the default (i.e., one or the other
is required).

Larry


On 1/4/06, Brandon Goodin <br...@gmail.com> wrote:
> Because it is an either/or circumstance. As far as i know you can't
> require one or the other in a DTD. Also, if i remember correctly larry
> had done this some time ago and wound up finding that there was a
> problem. Perhaps he can expound.
>
> Brandon
>
> On 1/4/06, Nathan Maves <Na...@sun.com> wrote:
> > Is there any reason that either (resultMap | resultClass) are not required
> > by the dtd for a sqlmap file?
> >
> > Nathan
> >
> >
> > On Jan 4, 2006, at 9:18 AM, Daan de Wit wrote:
> >
> >
> >
> > Hi,
> >
> >
> >
> > Today I found myself stuck with a very weird problem. A queryForList
> > returned an empty list while executing exactly the same query in the SQL
> > Query Analyzer returned one result. I thought that maybe the SQL Profiler
> > would be more informative about the problem, but query and the parameter
> > were both the same as I used in the Query Analayzer.
> >
> > It turned out that I forgot to set a resultmap for the select-statement.
> > Wouldn't it be better to throw an exception if no resultmap or resultclass
> > is found for a select? Or maybe the xml could be changed to something like
> > this:
> >
> > <select id="mySelect" resultType="map" resultId="myResultMap">
> >
> > I realize that the names I chose for the attributes are not that good, but
> > they are good enough to get the idea.
> >
> >
> >
> > Regards,
> >
> > Daan
> >
> >
> >
>

Re: select statement without resultmap

Posted by Brandon Goodin <br...@gmail.com>.
Because it is an either/or circumstance. As far as i know you can't
require one or the other in a DTD. Also, if i remember correctly larry
had done this some time ago and wound up finding that there was a
problem. Perhaps he can expound.

Brandon

On 1/4/06, Nathan Maves <Na...@sun.com> wrote:
> Is there any reason that either (resultMap | resultClass) are not required
> by the dtd for a sqlmap file?
>
> Nathan
>
>
> On Jan 4, 2006, at 9:18 AM, Daan de Wit wrote:
>
>
>
> Hi,
>
>
>
> Today I found myself stuck with a very weird problem. A queryForList
> returned an empty list while executing exactly the same query in the SQL
> Query Analyzer returned one result. I thought that maybe the SQL Profiler
> would be more informative about the problem, but query and the parameter
> were both the same as I used in the Query Analayzer.
>
> It turned out that I forgot to set a resultmap for the select-statement.
> Wouldn't it be better to throw an exception if no resultmap or resultclass
> is found for a select? Or maybe the xml could be changed to something like
> this:
>
> <select id="mySelect" resultType="map" resultId="myResultMap">
>
> I realize that the names I chose for the attributes are not that good, but
> they are good enough to get the idea.
>
>
>
> Regards,
>
> Daan
>
>
>

Re: select statement without resultmap

Posted by Nathan Maves <Na...@Sun.COM>.
Is there any reason that either (resultMap | resultClass) are not  
required by the dtd for a sqlmap file?

Nathan

On Jan 4, 2006, at 9:18 AM, Daan de Wit wrote:

> Hi,
>
>
>
> Today I found myself stuck with a very weird problem. A  
> queryForList returned an empty list while executing exactly the  
> same query in the SQL Query Analyzer returned one result. I thought  
> that maybe the SQL Profiler would be more informative about the  
> problem, but query and the parameter were both the same as I used  
> in the Query Analayzer.
>
> It turned out that I forgot to set a resultmap for the select- 
> statement. Wouldn’t it be better to throw an exception if no  
> resultmap or resultclass is found for a select? Or maybe the xml  
> could be changed to something like this:
>
> <select id=”mySelect” resultType=”map” resultId=”myResultMap”>
>
> I realize that the names I chose for the attributes are not that  
> good, but they are good enough to get the idea.
>
>
>
> Regards,
>
> Daan
>
>