我在xml中设置的查询顺序是这样的
<sql id="Base_Column_List"> id, create_time, update_time, username, password, email, phone, question, answer, role </sql> <select id="UserLogin" resultMap="BaseResultMap" parameterType="map"> SELECT <include refid="Base_Column_List"/> FROM user WHERE username = #{username} AND password = #{password} </select>
所以我的带参构造器是
public User(Integer id, Date createTime, Date updateTime, String username, String password, String email, String phone, String question, String answer, Integer role) { super(id, createTime, updateTime); this.username = username; this.password = password; this.email = email; this.phone = phone; this.question = question; this.answer = answer; this.role = role; }
debugger中显示出的查询顺序也是这样的
==> Preparing: SELECT id, create_time, update_time, username, password, email, phone, question, answer, role FROM user WHERE username = ? AND password = ? ==> Parameters: admin1(String), 30EB2604AC8157ABAE3D5B2863E6A54E(String)
但mybatis调用构造函数的时候却不是这个顺序,导致报错
User with invalid types (Integer,String,String,String,String,String,String,Integer,Date,Date) or values (25,admin1,30EB2604AC8157ABAE3D5B2863E6A54E,3333@qq.com,12345678910,问题,答案,1,Sat Dec 23 16:17:43 CST 2017,Sat Dec 23 17:31:48 CST 2017). java.lang.NoSuchMethodException: User.<init>(java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.util.Date, java.util.Date)
两个date属性放在了最后,为什么会这样?
cxxyjsj
相关分类