sql - ibatis 返回值

标签 sql ibatis

我目前正在使用 ibatis 返回一些 pojo,一切都很好。
我的问题是:
我必须从表中返回 1 行,就像 3 个字段一样,我不想为它创建一个 pojo。我只想运行查询并获取 3 个值。有没有简单的方法可以做到这一点,而无需为此创建一个特殊的 java 对象?

最佳答案

在 IBatis.NET 中,当我们需要一个查询中的多个值时,我们使用 Hashtable。

<resultMap id="ResultMap1"  class="Hashtable"> 
      <result column="FirstName" property="FirstName" type="string" /> 
          <!-- shows up as "FirstName"  in the Hashtable --> 
      <result column="LastName" property="LastName" type="string" /> 
          <!-- shows up as "LastName"  in the Hashtable --> 
</resultMap> 

关于sql - ibatis 返回值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/677761/

相关文章:

sql - 使用 Google bigquery 的日期中的两个日期之间的区别?

sql - 别名在 sql server 2008 r2 上不起作用

.net - 一个 dbml 中的数据库很少?

java - 检索数据时出错

java - 'source code does not match the bytecode' 使用IDEA调试JdbcTemplate

java - 带有 MyBatis 错误的 Spring MVC 4。

c# - 忽略缺失的列

sql - 如何循环遍历所有SQL表?

mysql - Mysql 中的转换和透视

java - 使用MyBatis Generator,当提供NULL值时如何为列指定默认值?