Inline SqlMapClientCallback on a MyBatis session

Proprietary

MyBatis-Spring has no counterpart to SqlMapClientTemplate.execute(SqlMapClientCallback), which iBatis code uses mostly to batch statements. Where the callback's result is not used, its body is inlined on a session opened from the template's SqlSessionFactory, a BATCH session where the callback called startBatch(), and the session is committed and closed after it. The session takes its connection from Spring, so it joins a transaction in progress, and commits on its own only when there is none. A callback is left alone when inlining would change what it means: when it returns early, calls JDBC code that throws SQLException, or declares a name the enclosing method already uses.

io.moderne.mybatis.InlineSqlMapClientCallback
mod run . --recipe=io.moderne.mybatis.InlineSqlMapClientCallback

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.