用mybatis plus ,连oracle ,程序执行时报错:
原本SQL是:select xtwldm,xtwlmc from xtm14的不知怎么,字段名称都分离了,都带下划线了?
JDBC Connection [oracle.jdbc.driver.T4CConnection@2ea50632] will not be managed by Spring
==> Preparing: SELECT x_t_w_l_d_m,x_t_w_l_m_c FROM xtm14
==> Parameters:
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5ebffb44]
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00904: "X_T_W_L_M_C": 标识符无效
### The error may exist in com/erdos/dao/Xtm14Dao.java (best guess)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT x_t_w_l_d_m,x_t_w_l_m_c FROM xtm14
### Cause: java.sql.SQLSyntaxErrorException: ORA-00904: "X_T_W_L_M_C": 标识符无效
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00904: "X_T_W_L_M_C": 标识符无效
部分代码Xtm14Dao.java:
package com.xxxx.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xxxx.domain.xtm14;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface Xtm14Dao extends BaseMapper<xtm14> {
@Select(" select XTWLDM,XTWLMC from xtm14 ")
public List<xtm14> GetYhjList();
}
只需要在application.yml里面增加下面的即可:
mybatis-plus: configuration: # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl map-underscore-to-camel-case: false