我目前正在使用 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/