Menu

How to set dynamic table name in xml file?

2006-08-25
2013-04-11
  • sunshine_ocean

    sunshine_ocean - 2006-08-25

    hey.
       help me, please....
       single object,set dynamic table name is very easy,I can use $tableName$.
       if object is complex,how i can set dynamic table name in child object.like this:
    <typeAlias alias="A" type="A"/>
    <typeAlias alias="B" type="B"/>
    <resultMap id="RA" class="A">
    <result property="id" column="PLUGIN_ID" javaType="java.lang.Long"/>
    <result property="name" column="NAME" javaType="java.lang.String"/>
    <result property="b" column="PLUGIN_ID" select="queryB"/>
    </resultMap>
    <resultMap id="RB" class="B">
    <result property="id" column="ROLE_ID" javaType="java.lang.Long"/>
    <result property="code" column="CODE" javaType="java.lang.String"/>
    </resultMap>
    <select id="queryA"
    parameterClass="ParamPlugin"
    resultMap="ResultPluginModel">
    <![CDATA[
    select *
    from $tableName$
    ]]>
    </select>
    <select id="queryB"
    parameterClass="int"
    resultMap="B">
    <![CDATA[
    select *
    from $tableName$ where PLUGIN_ID=#value#
    ]]>

    if this code has't $tableName$,it's right.but if has $tableName$.how i set parameterClass in id="queryB".
    if set parameterClass="int" ,then $tableName$ can't get.but set parameterClass="B".parent object's value
    can't get...

     
    • Larry Meadors

      Larry Meadors - 2006-08-25

      This forum is closed.

      Do not use it, but use the apache mailing lists instead.

      You will need to subscribe to a mailing list before posting to it.

      http://ibatis.apache.org/mailinglists.html

      Larry

       

Log in to post a comment.