ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Qian" <daqiqi...@aol.com>
Subject Re: composite keys
Date Mon, 09 Jan 2006 19:11:32 GMT
Larry,

I tried your suggestion. It didn't work. However, I found a work around. 
What I did was I added parameterClass="utilClass" which takes two data 
members in the selectClient statement as following:

<statement id="selectClient" parameterClass="utilClass" 
resultMap="select-client">
    select * from CLIENT_VERSION where brand_id=#brandId# and
    version_number=#version#
</statement>

Thanks,
Tony

Larry Meadors wrote on 1/7/2006, 1:05 PM:

 > We must do our models different - I just never use this feature.
 >
 > You may want to try this:
 >
 > <result property="clients"
 > column="{brandId=brandId, version=version}"
 > select="selectClient" />
 >
 > Larry
 >
 >
 > On 1/7/06, DaqiQian2@aol.com <DaqiQian2@aol.com> wrote:
 > >
 > > Larry,
 > >
 > > Thanks for your response. Here is my simplified sql mapping.
 > >
 > > <typeAlias alias="clientSession"
 > type="session.SimpleClientSessionInfo"/>
 > >   <typeAlias alias="parameter" type="session.SimpleSessionParameter"/>
 > >   <typeAlias alias="client" type="session.SimpleClient"/>
 > >
 > >   <resultMap id="select-sessionClient" class="clientSession">
 > >       <result property="brandId" column="brand_id" />
 > >       <result property="clients" column="{brandId=brand_id,
 > > version=version_number}" select="selectClient" />
 > >         </resultMap>
 > >
 > > <resultMap id="select-client" class="client">
 > >       <result property="brandId" column="brand_id" />
 > >       <result property="version" column="version_number"/>
 > >       <result property="isDefault" column="is_default"/>
 > >   </resultMap>
 > >
 > > <statement id="selectClient" resultMap="select-client">
 > >     select * from CLIENT_VERSION where brand_id=#brandId# and
 > > version_number=#version#
 > >   </statement>
 > >
 > > <statement id="getClientSessionInfo" parameterClass="map"
 > > resultMap="select-sessionClient">
 > >     select DISTINCT brand_id, version_number from
 > SESSION_INFO_PER_CLIENT
 > > having brand_id=#brandId# and version_number=#version#
 > >   </statement>
 > >
 > > I always get null  for property "clients" in the
 > select-sessionClient.  If I
 > > use single column for "selectClient", I can specify a
 > > parameterClass="string"  to pass that value to to selectClient
 > statement.
 > > Then it works correctly. However, when I use two columns, I have no
 > way to
 > > pass the values to selectClient statement. I tried
 > parameterClass="map",
 > > ibatis gave me error on initialize map.
 > >
 > > if you have a little bit time, you can take look the sql mapping i
 > sent out
 > > early.
 > > composite key mapping problem Tony Qian
 > >
 > > Any suggestions?
 > >
 > > Appreciate your time.
 > >
 > > Tony
 >



Mime
View raw message