Passing a non-column parameter in a MyBatis ResultMap to a nested select

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

Passing a non-column parameter in a MyBatis ResultMap to a nested select

Tom Allen
https://stackoverflow.com/questions/25303712/passing-a-non-column-parameter-in-a-mybatis-resultmap-to-a-nested-select

Is it possible for mybatis to supoorts this feature?

--
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.
Tim
Reply | Threaded
Open this post in threaded view
|

Re: Passing a non-column parameter in a MyBatis ResultMap to a nested select

Tim
That's already supported. I will try to create a working example (or find the stack overflow that I commented on this before). But basically you can just select that value as a column value inĀ selectFoosWithBars.
I'll respond to the stack overflow once I find the related stack overflow question.

In your particular cause you can use:

SELECT f.id f_id, f.name f_name, #{color} f_color FROM foos f WHERE f.name = #{name}
And use f_color in your sub select.

On Mon, Aug 21, 2017 at 11:40 PM, Tom Allen <[hidden email]> wrote:

--
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.