`
Copperfield
  • 浏览: 255244 次
  • 性别: Icon_minigender_1
  • 来自: 上海
博客专栏
C407adc3-512e-3a03-a056-ce4607c3a3c0
java并发编程陷阱
浏览量:24687
社区版块
存档分类

Mybatis-There is no getter for property named 'id' in 'class java.lang.String'

阅读更多

 

	<select id="findNoteByID" parameterType="string" resultType="note">
			SELECT * FROM TABLE 
			<where>		
						
				<choose>
					<when test="id != null and id !='' ">id = #{id}</when>
					<otherwise>1=2</otherwise>
				</choose>
			</where>
	</select>

 在测试时报错:There is no getter for property named 'id' in 'class java.lang.String'

 问题分析:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.id值,引起报错。

 解决方法:  public Note findNoteByID(@Param(value="id") String id);说明参数值。

分享到:
评论
3 楼 谁说我不是会员 2016-09-04  
luqixinhe 写道
用完freemaker 之后,再也不想用mybatis了


他两个有关系吗?
2 楼 luqixinhe 2015-12-25  
用完freemaker 之后,再也不想用mybatis了
1 楼 沧海月明z有泪 2015-10-21  
[b][/b]

相关推荐

Global site tag (gtag.js) - Google Analytics