简体   繁体   中英

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?

Try this:

@Select("dbcc useroptions")
@MapKey("Set Option")
Map<String, String> dbccUserOptions();

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM