求解决,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

ibatis配置多表关联(一对一、一对多、多对多)

iBatis的多表关联。ibatis的表关联,和数据库语句无关,是在Java程序中,把若干语句的结果关联到一起。这种关联形式,虽然在大数据量时是很奢侈的行为,但是看起来很干净,用起来也很方便。这里用表...
  • zzcv_
  • zzcv_
  • 2007年12月25日 17:22
  • 20666

ibatis使用resultMap处理级联查询

resultmap和resultclass的区别: 一:当结果集列名和类的属性名完全相对应的时候,则可直接用resultClass直接指定查询结果类型。 二:当查询结果集与属性名对应不上的时候,就...
  • u013628152
  • u013628152
  • 2015年09月24日 17:00
  • 2262

spring-security 异常 求解决

严重: Exception sending context initialized event to listener instance of class org.springframework.we...
  • chao331303
  • chao331303
  • 2014年06月27日 13:53
  • 2034

用位运算求两个整型数的平均值(避免溢出)

今天在CSDN上看了一个求两个数的平均值的算法:Avg = (ValueA & ValueB) + (ValueA ^ ValueB) >>1,这种方法避免了应用Avg=(ValueA+ValueB)...
  • tujinqiuqq85948239
  • tujinqiuqq85948239
  • 2014年04月20日 19:40
  • 830

ibatis oracle 批量添加之UncategorizedSQLException

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLExcepti...
  • lixuegen
  • lixuegen
  • 2016年03月16日 15:47
  • 513

动态规划 —— 阶乘

def fact(n, memo): if n == 0: return 1 if n not in memo: memo[n] = n*fact(n-1, memo)...
  • lanchunhui
  • lanchunhui
  • 2016年04月07日 18:36
  • 433

java web项目中的jsp页面发送ajax请求404错误

java web页面的ajax请求出现404错误
  • guggle15
  • guggle15
  • 2015年06月14日 18:44
  • 412

【解决】懒加载异常

异常描述:org.hibernate.LazyInitializationException: could not initialize proxy - no Session懒加载(延迟加载):懒加载...
  • FateHJ
  • FateHJ
  • 2016年06月18日 15:53
  • 683

BFPRT算法求第k大数

偶然间看到的东西,简单的看了看,不明觉厉……查了些资料,留待以后学习。 BFPRT算法_小彰_百度空间 十四、第三章再续:快速选择SELECT算法的深入分析与实现 - 结构之法 算法之道 - ...
  • whyorwhnt
  • whyorwhnt
  • 2013年10月19日 10:31
  • 912

ibatis 读取CLOB数据

如上面要加 javaType="String" jdbcType="CLOB"
  • chruan
  • chruan
  • 2012年01月09日 09:13
  • 1104
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:求解决,ibatis级联查询异常,求解决,哪里配置错了吗??(已经解决)
举报原因:
原因补充:

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