ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Odelya Glick" <ode...@jpost.com>
Subject Dynamic sql statement
Date Wed, 07 Nov 2007 21:28:24 GMT
Hi,

I have the following SQL statement:
<select id="getObituaParams" resultClass="obituary"
		parameterClass="basicObituary" cacheModel="obituaryCache">
		select 
		THUMB_PHOTO_LINK as thumbPhotoLink, LEADIN as leadin FROM
		OBITUARY 
		<dynamic prepend="where">
			<isNotEmpty prepend="OR"  property="firstName">
				upper(FIRST_NAME)=upper(#firstName#) and
status=1
			</isNotEmpty>
			<isNotEmpty prepend="OR" property="surName">
				upper(SUR_NAME)=upper(#surName#) and
status=1
			</isNotEmpty>
		</dynamic>
	</select>
I would like the dynamic sentence to be executed along with the condition:
If status=1 so it I will be:
Select * from OBITUARY where status=1 and (the dynamic sentence here).

How do I do it? Please note, that the dynamic sentence may not be build
since both firstname and suname will be empty, and only the status=1 will be
executed..

Thanks


Odelya Glick
JPost.com web-programmer
050-2052075
 


Mime
View raw message