Mapper Specific Variables

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

Mapper Specific Variables

Karthik K
I know that we can define Global Variables in the MyBatis config and use them in our Mappers. But, we have multiple Mappers in our project and would like to have the ability to define variables whose scope would be that mapper only, such that all the statements in that mapper would be able to use it, but not the ones in the other mappers.

Is there a way to achieve this?

With Regards
Karthik

--
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: Mapper Specific Variables

Kazuki Shimizu
Could you provide an actual use case?

On Sunday, November 19, 2017 at 11:39:30 AM UTC+9, Karthik K wrote:
I know that we can define Global Variables in the MyBatis config and use them in our Mappers. But, we have multiple Mappers in our project and would like to have the ability to define variables whose scope would be that mapper only, such that all the statements in that mapper would be able to use it, but not the ones in the other mappers.

Is there a way to achieve this?

With Regards
Karthik

--
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: Mapper Specific Variables

Karthik K
For eg: let’s assume most of the queries in a particular mapper work on table A. I would like to store the name of table A in a variable and then use that variable in the queries. So, that renaming that table in the future would become easy. I’m sure there are many more such use cases….

With Regards
Karthik

On 21-Nov-2017, at 5:41 PM, Kazuki Shimizu <[hidden email]> wrote:

Could you provide an actual use case?

On Sunday, November 19, 2017 at 11:39:30 AM UTC+9, Karthik K wrote:
I know that we can define Global Variables in the MyBatis config and use them in our Mappers. But, we have multiple Mappers in our project and would like to have the ability to define variables whose scope would be that mapper only, such that all the statements in that mapper would be able to use it, but not the ones in the other mappers.

Is there a way to achieve this?

With Regards
Karthik

--
You received this message because you are subscribed to a topic in the Google Groups "mybatis-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mybatis-user/0AtZTeBNGsw/unsubscribe.
To unsubscribe from this group and all its topics, 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.