Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Reflection Error
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
kweisser  
View profile  
 More options Oct 16 2012, 1:44 am
From: kweisser <kevin.weis...@gmail.com>
Date: Mon, 15 Oct 2012 22:44:32 -0700 (PDT)
Local: Tues, Oct 16 2012 1:44 am
Subject: Reflection Error
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 &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
&quot;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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry Meadors  
View profile  
 More options Oct 17 2012, 11:26 pm
From: Larry Meadors <larry.mead...@gmail.com>
Date: Wed, 17 Oct 2012 21:26:32 -0600
Local: Wed, Oct 17 2012 11:26 pm
Subject: Re: Reflection Error
That looks really overcomplicated, but change "WHERE id = #{id})" to
"WHERE id = #{value})" and it'll probably work. Can't say for sure
because you didn't send all the code. Try it first.

Larry


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »