Search code examples
javasql-serverjdbcibatismybatis

Running DBCC commands from Mybatis / Ibatis


I am trying to call a Sql Server DBCC command from mybatis and am getting back a list of the result names but not the values.

@select("dbcc useroptions")
List dbccUserOptions();

Returns only a list of the option names. Any ideas how to get the values?


Solution

  • After some experimentation I discovered this works:

    @select("dbcc useroptions")
    List<Map> dbccUserOptions();
    

    It turns out that Mybatis is inspecting the return type and if it is a list of scalars it will only return the first item.