我是这样做的,但是,错了。
<select id="select_into_map" resultMap="java.util.HashMap">
select userid,username from tbuser
</select>请问:ibatis中如何把查询结果放入HashMap中
<select id="select_into_map" resultMap="java.util.HashMap">
select userid,username from tbuser
</select>请问:ibatis中如何把查询结果放入HashMap中
解决方案 »
- 怎样连接gmail????????????????????????????
- weblogic 10.3 错误,求解?高分!!!
- 权限管理应该怎么写呢
- 用poi下载excel,在IE6下报服务器端错误,其他浏览器正常
- 关于如果表存在则不删除,如果表在则删除,表问下怎么写?
- 如何用APPLET在客户端修改服务器上的文件
- 问个DWR的问题,大家帮我呀。。。>>>>
- java注解
- hibernate和spring的数据库配置问题
- 请问如何读取ApplicationResources.properties中的值?50分
- 很简单 如何向sql server中加入字母+汉字呢???
- webservice xfire 问题
<resultMap class="Article" id="resultMap">
<result property="id" column="id"/>
</resultMap>
<select id="getResult" resultMap="resultMap" parameterClass="int">
select * from tb_article where id=#id#
</select>
你的hashmap是否对应到了,没有的话需要使用as命名引用名和配对的属性相同名称才可以的
SELECT * FROM PERSON WHERE ID = #{id}
</select>resultType从这条语句中返回的期望类型的类的完全限定名或别名。注意集合情形,那应该是集合可以包含的类型,而不能是集合本身。使用resultType或resultMap,但不能同时使用。
<resultMap class="java.util.HashMap" id="resultMap">
<result property="id" column="id"/>
</resultMap>
<select id="getResult" resultMap="resultMap" parameterClass="int">
select * from tb_article where id=#id#
</select>
和 java.util.Map 一点关系都没有。
<select id="select_into_map" resultType="java.util.Map">
select userid,username from tbuser
</select>
如果你用的是2我记得这么写<select id="select_into_map" resultClass="java.util.Map">
select userid,username from tbuser
</select>
<result property="id" column="id"/>
</resultMap>太麻烦。这么多人,出主意,8楼还说对。7楼正解。