tk.mybatis找不到表
最近刚接触tk.mybatis就遇到一个问题,我抄的代码竟然都报错了,我丢。
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: relation "em_spectype" does not exist
### The error may exist in ys/manufacture/equ/dao/SpringSpecTypeDao.java (best guess)
### The error may involve ys.manufacture.equ.dao.SpringSpecTypeDao.select-Inline
### The error occurred while setting parameters
### SQL: SELECT spectypepk,spectypecd,spectypename,descript,parenttypepk,isused,isdeleted,operatorpk,operatetime,remark FROM em_spectype WHERE spectypepk = ? AND spectypecd = ? AND isused = ? AND isdeleted = ?
### Cause: org.postgresql.util.PSQLException: ERROR: relation "em_spectype" does not exist
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: relation "em_spectype" does not exist
经过是这样的,我使用mybatis-generator逆向生成的实体类,按道理是不会出错的,但是问题就肯定是没有找到表。
网上百度了一下,说是要在实体类上边加@Table,但是我的实体类有这个注解。
我使用的是postgreSQL,和mysql 有点不同,它是有三层,而mysql只有两层
(pg)
(mysql)
所以最后@Table注解是这样写的,em.em_spectype