Mapper Specific Variables

18 views
Skip to first unread message

Karthik K

unread,
Nov 18, 2017, 9:39:30 PM11/18/17
to mybatis-user
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

Kazuki Shimizu

unread,
Nov 21, 2017, 7:11:49 AM11/21/17
to mybatis-user
Could you provide an actual use case?

Karthik K

unread,
Nov 21, 2017, 7:15:50 AM11/21/17
to mybati...@googlegroups.com
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

--
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 mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages