Is it possible to disable columnPrefix concat for specific resultMap?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to disable columnPrefix concat for specific resultMap?

ztyzbb
As shown in the link below:
https://github.com/mybatis/mybatis-3/issues/119
When resultMap is nested, parent columnPrefix with prefix to child one. For example: 
<resultMap id="A">
 
<result column="test"/>
</resultMap>

<resultMap id="B">
 
<collection columnPrefix="A_" resultMap="A"/>
</resultMap>

<resultMap id="C">
 
<collection columnPrefix="B_" resultMap="B"/>
</resultMap>
When I want to get "test" column in A, I have to use "`test` AS `B_A_test`" in select list. Is it possible to disable this concat for specific resultMap like C? Only prefix nearest columnPrefix to the column name, so I can reuse "A_test" in somewhere else like <resultMap id="E" columnPrefix="D_"> ====> <resultMap id="D" columnPrefix="A_"> ====> <resultMap id="A">.
In this case I can reuse same <sql id="Coloum_List> in much more place.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to disable columnPrefix concat for specific resultMap?

Iwao AVE!
Hi,

Please see my recent post in another thread.
It explains how to write a reusable <sql /> element.

Regards,
Iwao

On Thu, Dec 13, 2018 at 1:06 AM ztyzbb <[hidden email]> wrote:
As shown in the link below:
When resultMap is nested, parent columnPrefix with prefix to child one. For example: 
<resultMap id="A">
 
<result column="test"/>
</resultMap>

<resultMap id="B">
 
<collection columnPrefix="A_" resultMap="A"/>
</resultMap>

<resultMap id="C">
 
<collection columnPrefix="B_" resultMap="B"/>
</resultMap>
When I want to get "test" column in A, I have to use "`test` AS `B_A_test`" in select list. Is it possible to disable this concat for specific resultMap like C? Only prefix nearest columnPrefix to the column name, so I can reuse "A_test" in somewhere else like <resultMap id="E" columnPrefix="D_"> ====> <resultMap id="D" columnPrefix="A_"> ====> <resultMap id="A">.
In this case I can reuse same <sql id="Coloum_List> in much more place.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.