一 問題描述
使用者回報無法前台查詢資料,報錯500,背景檢視日志如下,使用的是ibatis+oracle連接配接方式:
09:05:56 INFO - atomikos connection proxy for oracle.jdbc.driver.LogicalConnection@24367013: close()...
09:05:56 ERROR - 擷取店内自己分類的清單資料發生異常~
--- The error occurred while applying a parameter map.
--- Check the SHOP.queryListByParentId-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: ORA-00904: "IS_DEFAULT": 辨別符無效
com.ibatis.common.jdbc.exception.NestedSQLException:
--- Check the SHO.queryListByParentId-InlineParameterMap.
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)
at com.supplier.service.impl.ShopServiceImpl.queryShopByParentId(ShopServiceImpl.java:119)
at sun.reflect.GeneratedMethodAccessor395.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at $Proxy61.queryShopByParentId(Unknown Source)
at com.supplier.action.SupplierBaseAction.setShopForList(SupplierBaseAction.java:690)
at com.supplier.action.product.ProductMainAction.showList(ProductMainAction.java:196)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
二 分析思路
1.檢查sql.xml配置沒有問題,字段和sql語句正常
2.檢查jdbc.xml配置檔案,檢視資料庫配置,登入對應資料庫,檢查表shop,發現shop下面确實沒有此字段IS_DEFAULT
三 解決方法
添加shop下的這個字段即可(之前忘記添加了)
檢查資料庫:
SQL> desc shop
Name Null? Type
----------------------------------------- -------- ----------------------------
SHOP_ID NOT NULL NUMBER(22)
MODIF_USER NUMBER(22)
EXEC_SQL VARCHAR2(250)
IS_EXPANDALL VARCHAR2(2)
正常情況:
SQL> desc shop
IS_DEFAULT VARCHAR2(2)
本文轉自 woshiwei201 51CTO部落格,原文連結:http://blog.51cto.com/chenwei/1703431