Notice the difference in syntax of parameters passed for schema or table name versus the parameters in sql condition like Where clause or And clause.
For table name use $paramName$ and for other conditions use #paramName#!
<resultMap id="jokersMap" class="com.ragsetty.jokers.Kilaadi">
<result property="name" column="PERSON_NAME" />
<result property="height" column="PERSON_HEIGHT" />
......
......
</resultMap>
<statement id="findAllJokers" parameterClass="java.util.Map" resultMap="jokersMap">
SELECT *
<dynamic prepend="FROM">
<isNotNull property="tableName">
$tableName$
</isNotNull>
<isNull property="tableName">
MY_SCHEMA.DEFAULT_PERSON_TABLE
</isNull>
</dynamic>
WHERE PERSON_TYPE = #personType#
</statement>
hello, does anyone know how to do an update of a table in ibatis having that the table name is dynamic?
ReplyDeleteThanks, nice tip
ReplyDeleteGlad. It could help you!
ReplyDelete