Mybatis 未设置主键映射报错;Cause: java.sql.SQLSyntaxErrorException: Unknown column 'system_id' in 'field list'

使用MyBatis的时候,主键的字段建议绑定在Bean的属性上面,

import javax.persistence.*;

public class User {
    @Id
    @Column(name = "systemId")
    private Long systemid;
}

否则会报错,以下是报错原文

"### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column 'system_id' in 'field list'

### The error may exist in cn/gobyte/apply/dao/user/userMapper.java (best guess)### The error may involve cn.gobyte.apply.dao.user.userMapper.selectByExample-Inline### The error occurred while setting parameters

### SQL: SELECT  system_id,id,password,tswt,mmda,email,sid,name,birthd,gender,mz,zzmm,tel,address,school,schoolc,major,gkbmh,bkmajor,mcode,jl,tc,lxaddress,yb,state,sj,zkzh,sf,creat_time,modify_time,last_login_time,theme,avatar,description,account_status  FROM users  WHERE (       (  id= ? ) )

### Cause: java.sql.SQLSyntaxErrorException: Unknown column 'system_id' in 'field list'\n; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column 'system_id' in 'field list'"
posted @ 2019-04-16 20:01  山岚  阅读(3910)  评论(0编辑  收藏  举报