Argh, nevermind. It helps if I actually check my select statement spelling between configs before I post to the mailing list. ;) All is well.

Eric T. Blue wrote:

Hi,

I have a number of objects/tables that require mapping, and in many instances there are 1-many relationships. In order to minimize duplication in the config files, I would like to be able to reference a select statement in another namespace/config file. For example:

// File 1

<sqlMap namespace="Object1">

<resultMap id="object1Result" class="com.ericblue.domain.Object1">
<result property="id" column="id"/>
<result property="name" column="name"/> <result property="someList" column="id" select="Object2.getSomeListByObject1"/> </resultMap>


</sqlMap>

// File 2

<sqlMap namespace="Object2">

   <resultMap id="object2Result" class="com.ericblue.domain.Object2">
       <result property="id" column="id"/>
       <result property="name" column="name"/>    </resultMap>

   <select id="getSomeListByObject1" resultMap="object2Result">
      select * from some_table where id = #id#
    </select>

</sqlMap>

Any help is appreciated!







Reply via email to