Seeing the underlying SQL in the Spring JdbcTemplate?

后端 未结 7 1021
深忆病人
深忆病人 2020-11-30 02:24

I am learning about the wonders of JdbcTemplate and NamedParameterJdbcTemplate. I like what I see, but is there any easy way to see the underlying SQL that it ends up execut

7条回答
  •  猫巷女王i
    2020-11-30 02:40

    Try adding in log4j.xml

    
    
        
    
    
    
    
        
    
    

    your logs looks like:

    DEBUG JdbcTemplate:682 - Executing prepared SQL query
    DEBUG JdbcTemplate:616 - Executing prepared SQL statement [your sql query]
    TRACE StatementCreatorUtils:228 - Setting SQL statement parameter value: column index 1, parameter value [param], value class [java.lang.String], SQL type unknown
    

提交回复
热议问题