求解决,ibatis级联查询异常,求解决,哪里配置错了吗??(已经解决)

原创 2012年03月27日 14:37:09

这是主表 xiuCentItem
<sqlMap namespace="XIU_CENT_ITEM" >
	<resultMap id="ibatorgenerated_BaseResultMap" class="com.pltfm.index.model.XiuCentItem">
		<!-- WARNING - This element is automatically generated by Apache iBATIS 
			ibator, do not modify. This element was generated on Wed Mar 21 19:47:05 
			CST 2012. -->
		<result column="CENT_ITEM_ID" property="centItemId" jdbcType="INTEGER" />
		<result column="ITEM_ID" property="itemId" jdbcType="INTEGER" />
		<result column="PARTNUMBER" property="partnumber" jdbcType="VARCHAR" />
		<result column="ITEM_NAME" property="itemName" jdbcType="VARCHAR" />
		<result column="ITEM_NAME_PRE" property="itemNamePre" jdbcType="VARCHAR" />
		<result column="ITEM_NAME_POST" property="itemNamePost"
			jdbcType="VARCHAR" />
		<result column="TAG_NAME" property="tagName" jdbcType="VARCHAR" />
		<result column="IMG_URL_TIME" property="imgUrlTime" jdbcType="VARCHAR" />
		<result column="BRAND_ID" property="brandId" jdbcType="INTEGER" />
		<result column="BRAND_NAME" property="brandName" jdbcType="VARCHAR" />
		<result column="BRAND_NAME_EN" property="brandNameEn" jdbcType="VARCHAR" />
		<result column="DESC_SHORT" property="descShort" jdbcType="VARCHAR" />
		<result column="STATE_ONSALE" property="stateOnsale" jdbcType="CHAR" />
		<result column="STATE_OFFSHOW" property="stateOffshow"
			jdbcType="CHAR" />
		<result column="ONSALE_TIME" property="onsaleTime" jdbcType="DATE" />
		<result column="FLAG_INSTMT" property="flagInstmt" jdbcType="CHAR" />
		<result column="AUTHOR" property="author" jdbcType="VARCHAR" />
		<result column="FLAG_GLOABL" property="flagGloabl" jdbcType="CHAR" />
		<result column="RMARK" property="rmark" jdbcType="VARCHAR" />
		<result column="ITEM_UPDATE_TIME" property="itemUpdateTime"
			jdbcType="DATE" />
		<result column="IMG_URL_SKU" property="imgUrlSku" jdbcType="VARCHAR" />
		<result column="DATA_STATE" property="dataState" jdbcType="CHAR" />
		<result column="CREATE_TIME" property="createTime" jdbcType="DATE" />
		<result column="UPDATE_TIME" property="updateTime" jdbcType="DATE" />
		<result column="ITEM_COLOR" property="itemColor" jdbcType="VARCHAR" />
		<result column="ITEM_SIZE" property="itemSize" jdbcType="VARCHAR" />
		<result column="ITEM_LIMIT" property="itemLimit" jdbcType="INTEGER" />
		<result column="SALE_PRE_START" property="salePreStart"
			jdbcType="DATE" />
		<result column="SALE_PRE_END" property="salePreEnd" jdbcType="DATE" />
		<result column="SALE_PRE_RECEIVE" property="salePreReceive"
			jdbcType="DATE" />
		<result column="SALE_LIMIT_START" property="saleLimitStart"
			jdbcType="DATE" />
		<result column="SALE_LIMIT_END" property="saleLimitEnd"
			jdbcType="DATE" />
		<result column="IMG_URL_VERSION" property="imgUrlVersion"
			jdbcType="VARCHAR" />
		<result column="PRODUCT_AREA" property="productArea" jdbcType="VARCHAR" />
		<result column="OFFSALE_TIME" property="offsaleTime" jdbcType="DATE" />
	</resultMap>
	<resultMap id="ibatorgenerated_DetailResultMap" extends="ibatorgenerated_BaseResultMap" class="com.pltfm.index.model.XiuCentItem">
		<!--result column="ITEM_ID" property="xiuCentPrice" jdbcType="INTEGER" resultMap="XIU_CENT_PRICE.ibatorgenerated_BaseResultMap"
               select="XIU_CENT_PRICE.ibatorgenerated_selectXiuCentPriceListByItemId"/-->
         <result column="ITEM_ID" property="xiuCentPrice"  select="XIU_CENT_PRICE.ibatorgenerated_selectXiuCentPriceListByItemId"/>
         <result column="ITEM_ID" property="xiuCentClass"  select="XIU_CENT_CLASS.ibatorgenerated_selectXiuCentClassListByItemId"/>
         <result column="ITEM_ID" property="xiuCentAttrList"  select="XIU_CENT_ATTR.ibatorgenerated_selectXiuCentAttrListByItemId"/> </resultMap>
 <select id="searchPageByVo" parameterClass="com.pltfm.index.model.XiuCentItem"
        resultMap="ibatorgenerated_DetailResultMap">
        SELECT
        <include refid="ibatorgenerated_column_name" />
        ,x_so_saletotal
        FROM (
        select
        ROW_NUMBER() OVER(order by CENT_ITEM_ID
        desc) as
        view_row_number,
        tt.* ,xspw.x_so_saletotal from
        XIU_CENT_ITEM tt
        left join x_so_productsale_week xspw on
        tt.partnumber=xspw.x_so_proceductid
        <dynamic prepend="where">
            <include refid="ibatorgenerated_select_column_where_selective" />
        </dynamic>
        ) WHERE view_row_number between #skip# and #max#
    </select>
    <!-- 手动添加 -->
</sqlMap>

这是字表

<sqlMap namespace="XIU_CENT_PRICE" >
  <resultMap id="ibatorgenerated_BaseResultMap" class="com.pltfm.index.model.XiuCentPrice" >
    <!--
      WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
      This element was generated on Wed Mar 21 19:47:05 CST 2012.
    -->
    <result column="CENT_PRICE_ID" property="centPriceId" jdbcType="INTEGER" />
    <result column="ITEM_ID" property="itemId" jdbcType="INTEGER" />
    <result column="PARTNUMBER" property="partnumber" jdbcType="VARCHAR" />
    <result column="PRICE_XIU" property="priceXiu" jdbcType="INTEGER" />
    <result column="PRICE_MKT" property="priceMkt" jdbcType="INTEGER" />
    <result column="PRICE_ACTIVITY" property="priceActivity" jdbcType="INTEGER" />
    <result column="TYPE_ACTIVITY" property="typeActivity" jdbcType="CHAR" />
    <result column="DATA_STATE" property="dataState" jdbcType="CHAR" />
    <result column="CREATE_TIME" property="createTime" jdbcType="DATE" />
    <result column="UPDATE_TIME" property="updateTime" jdbcType="DATE" />
  </resultMap>
    <select id="ibatorgenerated_selectXiuCentPriceListByItemId" parameterClass="java.lang.Integer"  resultMap="ibatorgenerated_BaseResultMap">
    select 
        <include refid="ibatorgenerated_column_name"  />
        from XIU_CENT_PRICE
        where ITEM_ID = #value# and rownum=1
    </select>
</sqlMap>


	public class XiuCentItem implements Serializable {
    /**
     * This field was generated by Apache iBATIS ibator. This field corresponds
     * to the database column XIU_CENT_ITEM.CENT_ITEM_ID
     * 
     * @ibatorgenerated Wed Mar 21 19:47:05 CST 2012
     */
    private Integer centItemId;

    /**
     * This field was generated by Apache iBATIS ibator. This field corresponds
     * to the database column XIU_CENT_ITEM.ITEM_ID
     * 
     * @ibatorgenerated Wed Mar 21 19:47:05 CST 2012
     */
    private Integer itemId;


        private List<XiuCentAttr> xiuCentAttrList = new ArrayList<XiuCentAttr>();
	private XiuCentClass xiuCentClass;
	private XiuCentPrice xiuCentPrice;
	private XiuCentItem xiuCentItem;

虽然去掉 
resultMap="XIU_CENT_PRICE.ibatorgenerated_BaseResultMap"

不会报异常,但是取得的xiuCentPrice 对象中的属性为空

还是要去掉那个

<result column="ITEM_ID" property="xiuCentPrice" jdbcType="INTEGER" resultMap="XIU_CENT_PRICE.ibatorgenerated_BaseResultMap"  select="XIU_CENT_PRICE.ibatorgenerated_selectXiuCentPriceListByItemId"/> 中的这个

resultMap="XIU_CENT_PRICE.ibatorgenerated_BaseResultMap"


 

 <sqlMap namespace="XIU_CENT_ATTR" >
  <resultMap id="ibatorgenerated_BaseResultMap" class="com.pltfm.index.model.XiuCentAttr" >
    <!--
      WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
      This element was generated on Wed Mar 21 19:47:05 CST 2012.
    -->
    <result column="CENT_ATTR_ID" property="centAttrId" jdbcType="INTEGER" />
    <result column="ITEM_ID" property="itemId" jdbcType="INTEGER" />
    <result column="ATTR_ID" property="attrId" jdbcType="INTEGER" />
    <result column="ATTR_NAME" property="attrName" jdbcType="VARCHAR" />
    <result column="ATTR_VALUE" property="attrValue" jdbcType="VARCHAR" />
    <result column="PARTNUMBER" property="partnumber" jdbcType="VARCHAR" />
    <result column="DATA_STATE" property="dataState" jdbcType="CHAR" />
    <result column="CREATE_TIME" property="createTime" jdbcType="DATE" />
    <result column="UPDATE_TIME" property="updateTime" jdbcType="DATE" />
  </resultMap>
<select id="ibatorgenerated_selectXiuCentAttrListByItemId" resultMap="ibatorgenerated_BaseResultMap"
		parameterClass="java.lang.Integer">
		select
		<include refid="ibatorgenerated_column_name" />
		from XIU_CENT_ATTR
		where ITEM_ID = #value#
	</select>
</sqlMap>



Cause: com.ibatis.sqlmap.client.SqlMapException: Error getting nested result map values for 'xiuCentPrice'.  Cause: java.sql.SQLException: 列名无效

    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:204)
    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.pltfm.index.dao.XiuCentItemDAOImpl.selectPageByVo(XiuCentItemDAOImpl.java:190)
    at com.pltfm.index.manager.XiuCentItemManager.searchXiuCentItemDetailByVO(XiuCentItemManager.java:57)
    at com.pltfm.index.service.XiuCentItemService.searchXiuCentItemDetailByVO(XiuCentItemService.java:42)
    at com.pltm.index.service.XiuCentItemServerTest.testSearchXiuCentItemDetailByVO(XiuCentItemServerTest.java:88)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.ibatis.sqlmap.client.SqlMapException: Error getting nested result map values for 'xiuCentPrice'.  Cause: java.sql.SQLException: 列名无效
    at com.ibatis.sqlmap.engine.mapping.result.ResultMap.setNestedResultMappingValue(ResultMap.java:467)
    at com.ibatis.sqlmap.engine.mapping.result.ResultMap.applyNestedResultMap(ResultMap.java:395)
    at com.ibatis.sqlmap.engine.mapping.result.ResultMap.setResultObjectValues(ResultMap.java:380)
    at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:64)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:385)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
    ... 33 more
Caused by: java.sql.SQLException: 列名无效
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
    at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3319)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1926)
    at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1563)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)
    at $Proxy8.getInt(Unknown Source)
    at com.ibatis.sqlmap.engine.type.IntegerTypeHandler.getResult(IntegerTypeHandler.java:35)
    at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619)
    at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)
    at com.ibatis.sqlmap.engine.mapping.result.ResultMap.setNestedResultMappingValue(ResultMap.java:454)
    ... 41 more

相关文章推荐

Android闪退,而且日志报系统自身错误或者异常位置没问题,你解决了吗?

朋友问我android应用闪退,而且报错的地方正确,问我怎么办? 作为有经验的程序员了,首先,我断定这肯定是异常捕获不了导致的闪退。所以请看下面我帮你。 我说你让我看看报错日志吧。发现的确有报...

ibatis使用resultMap处理级联查询

resultmap和resultclass的区别: 一:当结果集列名和类的属性名完全相对应的时候,则可直接用resultClass直接指定查询结果类型。 二:当查询结果集与属性名对应不上的时候,就...

ibatis的级联查询、resultmap和resultclass区别

今天用ibatis进行一对多级联查询的时候,一直出现多方的表不能查询到的问题 最后发现是关于resultclass和resultmap的含义没有搞清楚 下面是我的主要代码: User...

解决ibatis传入参数为NULL的异常

ibatis传入参数(一个对象)中某些属性为null,插入数据时出现异常。

hibernate级联查询执行n+1次sqlt语句问题(内含解决办法,优化方式)

如果当SQL数据库中select语句数目过多,就会影响数据库的性能,如果需要查询n个Customer对象,那么必须执行n+1次select查询语句,下文就将为您讲解这个n+1次select查询问题。 ...

myeclipse 工具解决 struts2、ibatis(mybatis) 配置文件不自动提示

不同的公司选择开发的工具不尽相同,不过java开源工具大家所熟知常用的无外乎eclipse与myeclipse 之前工作中用的就是myeclipse,换家公司后改为eclipse,现在又换回myec...

安装ADT的时候报错了(关于requires 'org.eclipse.gef 0.0.0' but it could not be found的解决方法)

今天在安装ADT的时候,提示“Cannot complete the install because one or more required items could not be found. ...

UVa 489 - Hangman Judge我就不明白了,哪里错了?(已解决)

为什么一直WA!! 苍天呀,大地啊~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 求解脱! 我的十一啊 ==========================...
  • gneveek
  • gneveek
  • 2011年09月30日 23:12
  • 1053

解决:easyui中的datagrid详情展开,combobox的级联操作,以及修复combobox总是显示value值的问题

先来看下效果 var comboboxData;//项目与部门 field内的combobox data var datagrid; $(function() { //输入url获得d...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:求解决,ibatis级联查询异常,求解决,哪里配置错了吗??(已经解决)
举报原因:
原因补充:

(最多只允许输入30个字)