數據庫 常見錯誤

錯誤一:java

 

 

<!--查找算法池中的記錄-->
<select id="findPageByalgorithmpool" resultType="AlgorithmPool">
   SELECT
   *
   FROM algorithmpool a
   <where>
      a.del_flag = #{DEL_FLAG_NORMAL}
      <if test="algorithmName != null and algorithmName != ''">
         AND a.algorithm_name LIKE
         concat(#{algorithmName},'%')<!-- CONCAT:拼接sql-->
      </if>
   </where>
   <choose>
      <when test="page !=null and page.orderBy != null and page.orderBy != ''">
         ORDER BY ${page.orderBy}
      </when>
      <otherwise>
         ORDER BY a.update_date DESC
      </otherwise>
   </choose>
</select>

錯誤二:mysql

Caused by: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.jeeplus.modules.algorithmneed.dao.AlgorithmNeedDao.myCliam'.  It's likely that neither a Result Type nor a Result Map was specified.
 算法

緣由:配置文件沒有resultType屬性spring

正確寫法:sql

錯誤三:數據庫

### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jeeplus_maven.sys_dict' doesn't exist
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jeeplus_maven.sys_dict' doesn't exist
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
    at com.sun.proxy.$Proxy22.selectList(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198)
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
    at com.sun.proxy.$Proxy55.findAllList(Unknown Source)
    at com.jeeplus.modules.sys.utils.DictUtils.getDictList(DictUtils.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.el.parser.AstFunction.getValue(AstFunction.java:195)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:115)
    ... 74 more
apache

錯誤緣由:檢查數據庫中的相關數據表是否存在mybatis

相關文章
相關標籤/搜索