develog

[mybatis] get mybatis sql 본문

카테고리 없음

[mybatis] get mybatis sql

냐옴 2019. 8. 6. 11:38

getSql

private String getSql(String mapId, Object param) {
    SqlSession sqlSession = (SqlSession) applicationContext.getBean("sqlSessionTemplate");
    Configuration configuration = sqlSession.getConfiguration();
    MappedStatement mappedStatement = configuration.getMappedStatement(mapId);
    BoundSql boundSql = mappedStatement.getBoundSql(param);
    String sql = boundSql.getSql();
    return sql;
}
Comments