You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Aram Mkhitaryan <ar...@googlemail.com> on 2007/08/02 07:08:18 UTC
Result Map Issue
Hi,
I'm trying to configure result maps that are able set some properties from
the parameter map.
For example, I'm loading the profile and the input parameter is the
account, and I have to set the given account ot the profile.
But after select in the result map only the result set is available.
Here is what I want to have ...
class Account {
Profile profile;
}
class Profile {
Account account;
}
<select id="getAccount" resultMap="accountResult" parameterClass="int">
...
</select>
<resultMap id="accountResult">
...
<result property="profile" column="id" select="getProfile"/> -->>> i would
like to specify here not the column , but the account object itself
</resultMap>
<select id="getProfile" resultMap="profileResult" parameterClass="int">
-->>> i would like to have here parameterClass="account"
...
</select>
<resultMap id="profileResult" parameterRef="account"> --> the
parameterRef="account" , i would like to have that
...
<property name="account" ref="account" /> -->> it would be nice to be able
to have generic syntax like ref="account.username"
</resultMap>
Is it possible to do so, or it is something new that need to be implemented?
If it is new feature, can someone help me to know how I can contribute ?
It's too urgent, please, HELP!
Thank you in advance,
Aram
________________________________
Aram Mkhitaryan
52, 25 Lvovyan, Yerevan 375000, Armenia
Mobile: +374 91 518456
E-mail: aram.mkhitaryan@googlemail.com
Re: Result Map Issue
Posted by Brandon Goodin <br...@gmail.com>.
Why don't you just handle that in your dao.
public Account getAccount(Integer accountId) {
Account account = sqlMapClient.queryForObject("getAccount",accountId);
Profile profile = sqlMapClient.queryForObject("getProfile",Account
account);
account.setProfile(profile);
return account;
}
Brandon
On 8/2/07, Aram Mkhitaryan <ar...@googlemail.com> wrote:
>
> Hi,
>
> I'm trying to configure result maps that are able set some properties
> from the parameter map.
> For example, I'm loading the profile and the input parameter is the
> account, and I have to set the given account ot the profile.
> But after select in the result map only the result set is available.
>
> Here is what I want to have ...
>
> class Account {
> Profile profile;
> }
>
> class Profile {
> Account account;
> }
>
> <select id="getAccount" resultMap="accountResult" parameterClass="int">
> ...
> </select>
>
> <resultMap id="accountResult">
> ...
> <result property="profile" column="id" select="getProfile"/> -->>> i would
> like to specify here not the column , but the account object itself
> </resultMap>
>
> <select id="getProfile" resultMap="profileResult" parameterClass="int">
> -->>> i would like to have here parameterClass="account"
> ...
> </select>
>
> <resultMap id="profileResult" parameterRef="account"> --> the
> parameterRef="account" , i would like to have that
> ...
> <property name="account" ref="account" /> -->> it would be nice to be
> able to have generic syntax like ref=" account.username"
> </resultMap>
>
> Is it possible to do so, or it is something new that need to be
> implemented?
>
> If it is new feature, can someone help me to know how I can contribute ?
>
> It's too urgent, please, HELP!
>
> Thank you in advance,
> Aram
> ________________________________
> Aram Mkhitaryan
>
> 52, 25 Lvovyan, Yerevan 375000, Armenia
>
> Mobile: +374 91 518456
> E-mail: aram.mkhitaryan@googlemail.com