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 "Rao, Satish" <sa...@fmr.com> on 2005/07/14 17:23:15 UTC

Using WHERE IN along with AND

I have the following <select> and it throws a UncategorizedSQL
exception...

	<select id="listDetailsForOrderIds"
parameterClass="java.util.List" resultMap="list-rundetail-result">
		SELECT 
			R.ORD_ID AS ORD_ID,
			PART_ID,
			CLNT_ID_N,
			PLAN_N,
			PROD_ID_C,
			OFFR_C,
			PRTY_N,
			EMAIL_ADDR_X
		FROM 
			TABLE1 R, TABLE2 O
		<dynamic prepend="WHERE">
		<iterate
		     open=" R.ORD_ID IN (" 
		     close=")" conjunction=",">
		     #orderIdList[]#
		</iterate>
		<isNotEmpty prepend="AND" property="orderIdList">
			R.ORD_ID = O.ORD_ID
		</isNotEmpty>
		</dynamic>
	</select>

It works correctly without the <isNotEmpty> tag. But as soon as I add
the <isNotEmpty> construct it throws a Uncategorized SQL Exception. Can
we not pass a java.util.List property type to <isNotEmpty> tag?

orderIdList is a java.util.List