ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: Circular dependency?
Date Wed, 08 Jun 2005 16:01:38 GMT
It is always better to write to the list. This will allow for other's
to provide info to you as well. I work during the day and am not able
to always respond quickly. I'll forward this on to the list and see if
others can provide you info. Otherwise, I'll try to get some time this
evening.

Brandon

On 6/8/05, Ersin Er <ersin.er@cs.hacettepe.edu.tr> wrote:
> Excuse me but I'm trying to understand to complete a documentation which
> make more sense for me. Could you explain, then, how can we implement
> such a relationship? The Category class has a list of products, and the
> Product class has a reference to a Category. How should the xml map
> should be?
> 
> Thanks in advance.
> 
> (May I ask a few private mail questions, to not make the list
> subscribers bored?)
> 
> --- Ersin
> 
> Brandon Goodin wrote:
> 
> >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 <ersin.er@cs.hacettepe.edu.tr> 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
> >>
> >>
> >>
> 
> 
>

Mime
View raw message