× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi

I have a table with columns,
view
code
color

and i want to write a query like

select color from table where view=? and code in
(?,?,?)
Where in factor may be one to 100 or more
then in ibatis i defined it in ibatis as below

<parameterMap id="getNotesMap"
class="java.util.HashMap">
<parameter property="view"
javaType="java.lang.String " />
<parameter property="notes"
javaType="java.util.List" />
</parameterMap>

<select id="getNotesForScheduling"
resultClass="java.util.HashMap"

parameterMap="getNotesMap">

select color from table
<dynamic prepend="where">
<iterate prepend="AND" property="notes" open="("
close=")"
conjunction="OR">
code=#notes[]#
</iterate>
and view =#view#
</dynamic>

</select>

This would build a query like below at runtime
select color from table where (code='ABC' or
code='XYZ' or code='KLM') and view= view

Hope this explains the way i have resolved it

Regards
Ashish
--- albartell <albartell@xxxxxxxxx> wrote:

Agreed! I would like to see ibatis in action. I am
a semi-satisfied
Hibernate user.

Aaron Bartell
http://mowyourlawn.com


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Ducie
Sent: Tuesday, September 18, 2007 5:57 AM
To: java400-l@xxxxxxxxxxxx
Subject: Re: SQL question with where in clause -
Solved using ibatis

Hi Ashish,

<snip>
if some on is interested let me know i will post the
way i defined in ibatis
in this forum </snip>

Post it. Even if nobody is interested today, its
always good for people next
week/month/year.

Nothing worse than googling a problem and finding a
poster who had the
solution and didn't post it because nobody was
interested at the time. Too
many times have I shouted "I'm interested!", but its
usually at least 2
years after the thread died. :-)

Sigh, maybe its just me. ;-)

Larry Ducie


--
This is the Java Programming on and around the
iSeries / AS400 (JAVA400-L)
mailing list To post a message email:
JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before
posting, please take a
moment to review the archives at
http://archive.midrange.com/java400-l.

--
This is the Java Programming on and around the
iSeries / AS400 (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the
archives
at http://archive.midrange.com/java400-l.




A$HI$H




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.