ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: Multiple queries in one call
Date Mon, 11 Jul 2005 20:49:22 GMT
What error do you get? Chances are that iBATIS does not process the
injected SQL ($sql$) so it submits ##mytemptable to the database. Please
post the exception you get, otherwise this is my best shot :)

Maybe you should consider moving the query to the SQLMap instead of
injecting it directly, as your current solution poses a security risk
(i.e. you have no way to control the given SQL).

Hope this helps,

Niels

-----Original Message-----
From: Barnett, Brian W. [mailto:brian.barnett@pearson.com] 
Sent: maandag 11 juli 2005 22:29
To: 'user-java@ibatis.apache.org'
Subject: Multiple queries in one call

Anyone know how to make something like this work in MS SQL Server? I
have
two select statements, the first selects into a temp table and the
second
selects from the temp table. I want to do it in one call to the db. I
need
help with the SQL. I can execute both queries in SQL Query Analyzer just
fine, but I can't when I use iBATIS. Is there a different syntax I need
to
use?

The SQL is something like this:
SELECT col1, col2 FROM table1 INTO ##mytemptable
JOIN table2 ON blah blah
JOIN table3 ON blah blah
WHERE blah blah

SELECT DISTINCT col1, col2 FROM ##mytemptable


SQL Map snippet:
<select id="getData" resultMap="result_map"
parameterClass="java.util.HashMap">
	$sql$
</select>

TIA,
Brian Barnett

************************************************************************
**** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
************************************************************************
****

Mime
View raw message