ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Неверов Дмитрий <neverov...@nkmk.ru>
Subject Re: order by problem
Date Fri, 16 Sep 2005 02:14:48 GMT
Hi, Неверов.

Sorry, it use another SqlMap File, I change it and  all is OK.
---------------------------------
You wrote 16 сентября 2005 г., 9:57:45:

> Hi, 

>     I have sqlMap:
    
> <?xml version='1.0' encoding='windows-1251'?>
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-2.dtd">

> <sqlMap namespace="elementInGost">
>   <typeAlias alias="ElementInGost"
> type="nkmk.ibatis.domain.ElementInGost"/>
>   <typeAlias alias="Interval" type="nkmk.ibatis.domain.Interval"/>
  
>   <resultMap id="ElementWithIntervals" class="ElementInGost">
>     <result column="id_elem" property="elementId"/>
>     <result column="sname" property="shortName"/>
>     <result column="lname" property="longName"/>
>     <result column="id_gost" property="gostId"/>
>     <result column="{gostId=id_gost, elementId=id_elem}"
> property="intervalList"
> select="elementInGost.getIntervalsOfElement"/>
>   </resultMap>
  
>   <statement id="searchElementInGost"
> parameterClass="ElementInGost"
> resultMap="elementInGost.ElementWithIntervals">
>     select distinct t1.id_elem, 
>            t1.id_gost,
>            t2.sname, 
>            t2.lname            
>     from sp_gost_detail t1, sp_name_nsi t2
>     where t2.id = t1.id_elem
>     and t1.id_elem=#elementId#
>       and t1.id_gost=#gostId#
>   </statement>

>   <statement id="getIntervalsOfElement" resultClass="Interval">
>     select t2.id intervalId,  
>            t1.kf kf, 
>            t2.conc_ot concOt, 
>            t2.conc_do concDo
>     from sp_gost_detail t1, sp_interval t2
>     where t2.id=t1.id_interval(+)
>     and t1.id_elem(+)=#elementId#
>     and t1.id_gost(+)=#gostId#
>     order by  t2.id
>   </statement>

> </sqlMap>

> ElementInGostSqlMapDao:
> ....

>   public ElementInGost getElementById(int gostId, int elementId)
>   {
>     ElementInGost elem = new ElementInGost();
>     elem.setGostId(new Integer(gostId));
>     elem.setElementId(new Integer(elementId));
>     return (ElementInGost)
> queryForObject("elementInGost.searchElementInGost", elem);
>   }
> ...


> Then I have Element object and call element.getIntervalList(), which
> return List using "getIntervalsOfElement" from sqlMap file. And
> this List is always order by kf field. Why? I change  "order by
> t2.id" to, for example, "order by t1.kf desc" but there's no changes.

> Why??


---------------------------------
-- 
Неверов                          mailto:neverov_dg@nkmk.ru





Mime
View raw message