---
title: "mybatis There is no getter for property named 'xxxx' in 'class java.lang.Integer"
author: "cy913417"
date: "2012-09-12T15:07:17Z"
tags: []
categories: ["数据库"]
slug: "mybatis-there-is-no-getter-for-property-named-xxxx-in-class-java-lang-integer"
draft: false
lastmod: "2012-09-12T15:06:25Z"
id: 1676864
url: "https://it456.iteye.com/blog/1676864"
---

mybatis查询 是传参 报

```
 There is no getter for property named 'xxxx' in 'class java.lang.Integer
```

 这里是传入一个integer类型的参数，结果报上述异常

以下为sql写法：

```
	select  top ${contentSize} MAX(PrimaryKeyId) as id FROM  Content_TEMP  GROUP BY id 
		
```

 此处报

```
There is no getter for property named 'contentSize' in 'class java.lang.Integer
```

 

解决方法有二：

   1.将 参数名称 "contentSize" 替换为"\_parameter" 

   结果正常。

   2. 在接口中定义方法时 增加[“@Param](mailto:%E2%80%9C@Param)("contentSize")” 标记

    即：

 

```
 List<xxxx>  selectContent(@Param("contentSize")int contentSize);
```

    结果正常。