Currently a circular dependency would not be possible because of the
way configurations are loaded. One sql map must be loaded before the
other can. So, if you attempted a circular reference it would fail
during intialization because the referenced mapped statement would not
be found in the configuration. So, a mapped statement would have to be
in the configuration before it was referenced by the result element.

This has not been a major problem so far. But, it is a high priority
change that we hope to address for the next release.

Brandon

On 6/6/05, Ersin Er <[EMAIL PROTECTED]> wrote:
> On page 27 of iBatis SQL Mapper Doc the following mapping xml file is given:
> 
> <resultMap id="get-category-result"
> class="com.ibatis.example.Category">
> <result property="id" column="CAT_ID"/>
> <result property="description" column="CAT_DESCRIPTION"/>
> <result property="productList" column="CAT_ID" select="
> getProductsByCatId"/>
> </resultMap>
> <resultMap id="get-product-result"
> class="com.ibatis.example.Product">
> <result property="id" column="PRD_ID"/>
> <result property="description" column="PRD_DESCRIPTION"/>
> </resultMap>
> <statement id="getCategory" parameterClass="int"
> resultMap="get-category-result">
> select * from CATEGORY where CAT_ID = #value#
> </statement>
> <statement id="getProductsByCatId" parameterClass="int"
> resultMap="get-product-result">
> select * from PRODUCT where PRD_CAT_ID = #value#
> </statement>
> 
> For the corresponding object model, the Category class should have
> productList property, OK. What about Product class? Can it have a
> reference to Category?
> 
> Thanks.
> 
> --
> Ersin
>

Reply via email to