- ${_databaseId}にdatabaseIdの文字列を設定 * - http://mybatis.org/freemarker-scripting/jacoco/org.mybatis.scripting.freemarker/FreeMarkerSqlSource.java.html */ public static class CustomSqlSource extends FreeMarkerSqlSource { private String dbms; public CustomSqlSource(Template template, org.apache.ibatis.session.Configuration configuration, Version version) { super(template, configuration, version); this.dbms = configuration.getDatabaseId(); } @Override protected Object preProcessDataContext(Object dataContext, boolean isMap) { dataContext = super.preProcessDataContext(dataContext, isMap); if (isMap) { ((Map<String, Object>) dataContext).put("_databaseId", new SimpleScalar(this.dbms)); return dataContext; } ((ParamObjectAdapter) dataContext).putAdditionalParam("_databaseId", new SimpleScalar(this.dbms)); return dataContext; } }