I'm getting error that I can't seem to understand. I'm using the mybatis 3.2
Snapshot jar.
The error is:
### Error querying database. Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter for
property named 'lineNo' in 'class java.lang.String'
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no
getter for property named 'lineNo' in 'class java.lang.String'
My XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="....data.mapperMyObjectMapper">
<resultMap id="line" type="....model.Line">
<result property="lineNo" column="LINE_NO"
typeHandler=".....data.typehandlers.LineNoTypeHandler"/>
</resultMap>
<select id="loadDetail" parameterType="String" resultMap="line"
resultType="....model.Line">
SELECT ID AS "id", LINE_NO
FROM detail
WHERE id = #{id})
FOR FETCH ONLY
</select>
...
My Line Object is as follows:
public class Line implements Serializable {
private Integer lineNo = Integer.valueOf(0);
private String id = "";
public String getId(){
return id;
}
public void setId(String id){
this.id = id;
}
public Integer getLineNo(){
return lineNo;
}
public void setLineNo(Integer lineNo) {
this.lineNo = lineNo:
}
....
}
The lineNo is a CHAR in the DB but I am using it as an Integer for various
reasons.
I assume the error would go away if I change lineNo to be String, but I as I
said there are various reasons for me not to do this. I expected it to hit
my typeHandler which would handle the String to Integer conversion, but it's
not making it that far.
Any suggestions on how to work around this?
--
View this message in context: http://mybatis-user.963551.n3.nabble.com/Reflection-Error-tp4025858.html
Sent from the mybatis-user mailing list archive at Nabble.com.