Hi, Mybatis!
My predecessor made a query that was close to 1000 lines and left the company.
The problem was a query with transactions tied up, but I only had to service the results of doing a simple query.
The solution is simple. Just create a new slave mapper and copy it.
However, this causes a situation where the source needs to be modified twice.
So I thought that I would like to have the option to force SqlSession to be specified when executing a query in Mybatis.
Basically, it uses A session, but puts the option as below to use B session connected to Slave DB.
ex)
A.java
@Options(sqlSessionRef="slaveSqlSession")
public int updateVeryLongQuery();
A.xml
<select id="updateVeryLongQuery">
... very long query ...
</select>
Is there any way to do this?
Thank you for reading.
Have a nice day! And please be safe from corona-19.