ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob <gnomek...@gmail.com>
Subject Re: sql server 2k parameterized queries
Date Thu, 23 Mar 2006 08:37:40 GMT
On 23/03/06, Larry Meadors <lmeadors@apache.org> wrote:
> Can you post the mapped statement?

Certainly - but it is very simple!

	<statement id="getPayoutOrgData" resultClass="java.util.HashMap">
		SELECT EVENT.EVENTCD,
			sum(WTRANS.NETSTAMT) AS NET_VALUE
		FROM WTRANS
			INNER JOIN EVENT
				ON WTRANS.EVENTCD = EVENT.EVENTCD
		WHERE WTRANS.TRX_TYPE='S'
			AND WTRANS.[FUNCTION]=1
			AND #shows#
		GROUP BY EVENT.EVENTCD, EVENT.NAME
		ORDER BY EVENT.NAME
	</statement>

I am querying with:

        Map filters = new HashMap();
        filters.put("shows", shows);
        List ret = getSqlMap().queryForList(
                    "getPayoutOrgData",
                    filters);

shows is a string of the following format: (it is dynamically created
and can be quite long, but the example which is falling over has just
one entry)
(WTRANS.EVENTCD="ABC" OR WTRANS.EVENTCD="DEF")

... thinking about it, is that the problem? Can I use a parameterized
statement when an entire where clause is dynamically generated?

Bob

Mime
View raw message