title: MyBatis - Connect to multiple databases in the same service call
body: <p>I have a requirement to connect to multiple databases to query and consolidate data before returning it to the users. Is there a way of doing it using MyBatis and cdi? I looked into using <a href="http://www.mybatis.org/mybatis-3/configuration.html#databaseIdProvider" rel="nofollow noreferrer">DatabaseIdProvider</a> and having <a href="http://www.mybatis.org/mybatis-3/configuration.html#environments" rel="nofollow noreferrer">multiple environment configurations</a> but looks like they will not work for this scenario. With multiple environment configurations I can create different sql session factories, but how will cdi for mappers work in that case? I would like to use cdi as much as possible. Will MyBatis Guice help with this? I have looked at a <a href="https://stackoverflow.com/questions/33917115/equivalent-of-mybatis-xml-multiple-environments-in-mybatis-guice">similar</a> question but I am unable to determine if Guice will help in this case where I need to query multiple databases in the same service call.</p>