SQL 配置如下:
<select id="queryUser" resultClass="CustomVO"
parameterClass="UserVO">
<!-- [CDATA[ -->
SELECT *
  FROM TUSER C
<dynamic prepend="WHERE">
<isNotEmpty prepend="AND" property="userSort">
(C.CUSTOMERSORT = #userSort#)
</isNotEmpty>
<isNotEmpty prepend="AND" property="userCode">
(C.USERCODE LIKE '%' || #userCode# || '%')
</isNotEmpty>
<isNotEmpty prepend="AND" property="userName">
(C.USERNAME LIKE '%' || #userName# || '%')
</isNotEmpty>
<isNotEmpty prepend="AND" property="areaId">
(EXISTS (SELECT 1
          FROM (SELECT B.AREAID
                  FROM PUB_AREA B
                CONNECT BY PRIOR B.AREAID = B.PARENTID
                 START WITH B.AREAID IN
                            (SELECT A.AREAID
                               FROM PUB_AREA A
                              WHERE INSTRB('$' || #areaId# || '$',
                                           '$' || A.AREAID || '$') > 0)) T
         WHERE T.AREAID = C.AREAID))
</isNotEmpty>
<isNotEmpty prepend="AND" property="servLevel">
(C.SERVLEVEL = #servLevel#)
</isNotEmpty>
<isNotEmpty prepend="AND" property="corpType">
(C.INDUSTTYPE = #corpType#)
</isNotEmpty>
<isNotEmpty prepend="AND" property="userState">
(C.USERSTATE = #userState#)
</isNotEmpty>
</dynamic>
<!-- ]]> -->
</select>问题描述:
    异常1:如果查询时没有传入areaId的值,而传入了其它条件的值时,IBATIS执行正常并返回结果;如果传入了areaId的条件值时,则IBATIS执行抛出异常如下:
--- The error occurred while preparing the mapped statement for execution.  
--- Check the queryCustom.Count.  
--- Check the parameter map.  
--- Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named '' || ? || '' in class '……   异常2:如果启用上面的<![CDATA[ ……]]>符,则不传入任何条件值,IBATIS执行时 都抛出上面同样的异常。请问各位大侠,这是什么原因?如何解决??急急急……

解决方案 »

  1.   

    另外还有一个,在Eclipse里启动JBOSS,在运行一段时间后,无缘无故的死掉了:17:47:52,640 WARN  [Parameters] Parameters: Invalid chunk ignored.
    #
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0090b39d, pid=4888, tid=3200
    #
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode)
    # Problematic frame:
    # V  [jvm.dll+0xcb39d]
    #
    # An error report file with more information is saved as hs_err_pid4888.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    #
      

  2.   

    --- The error occurred while preparing the mapped statement for execution.  
    --- Check the queryCustom.Count.  
    --- Check the parameter map.  
    --- Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named '' || ? || '' in class '…… 你配置 resultsMap了没有? 很显然是映射错误啊,最好配置下。 There is no READABLE property named '' || ? || '' in class '
    把'' || ? || ''  当成名字解析了啊。卡参考下我的 ibatis配置:<typeAlias alias="BudgetAmend" type="fund.mb.domain.BudgetAmend" /> <resultMap id="BudgetAmend-result" class="BudgetAmend">
    <result property="id" column="ID" />
    <result property="versionCode" column="VERSION_CODE" />
    <result property="budgetPeriod" column="BUDGET_PERIOD" />
    <result property="budgetSpace" column="ID_SPD_SECTION_SPACE" />
    <result property="inputTime" column="INPUTDATE" />
    <result property="idPerson" column="ID_PERSON" />
    <result property="flag" column="FLAG" />
    <result property="enddate" column="ENDDATE" />
    <result property="idCompany" column="ID_COMPANY" />
    <result property="startdate" column="STARTDATE" />
    <result property="budgetComment" column="BUDGET_COMMENT" />
    </resultMap> <select id="getAllBudgetAmend" resultMap="BudgetAmend-result">
    select *
    from
    MB_BUDGET
    </select> <typeAlias alias="BudgetAmendDmod" type="fund.mb.domain.BudgetAmendDmod" />
    <resultMap id="BudgetAmendDmod-result" class="BudgetAmendDmod">
    <result property="id" column="ID" />
    <result property="budgetProjectId" column="ID_SPD_BUDGET_PROJECT" />
    <result property="budgetProjectName" column="ID_PSD_BUDGET" />
    <result property="budgetAmount" column="BUDGET_AMOUNT" />
    <result property="changeAmount" column="CHANGE_AMOUNT" />
    <result property="newChangeAmount" column="NEWCHANGE_AMOUNT" />
    <result property="upExpectAmount" column="UPEXPECT_FAAMOUNT" />
    <result property="upyearFactAmount" column="UPYEAR_FAAMOUNT" />
    <result property="useAmount" column="USE_AMOUNT" /> </resultMap>
    <select id="getBudgetAmendDmodById" parameterClass="java.lang.String" resultMap="BudgetAmendDmod-result">
    select *
    from MB_BUDGETDETAIL WHERE ID=#id#
    </select>
    <update id="updateBudgetAmendDmod" parameterClass="BudgetAmendDmod">
    update
    MB_BUDGETDETAIL SET
    ID_SPD_BUDGET_PROJECT=#budgetProjectId#,ID_PSD_BUDGET=#budgetProjectName#,
    BUDGET_AMOUNT=#budgetAmount#,CHANGE_AMOUNT=#changeAmount#,NEWCHANGE_AMOUNT=#newChangeAmount#,
    UPEXPECT_FAAMOUNT=#upExpectAmount#,UPYEAR_FAAMOUNT=#upyearFactAmount#,USE_AMOUNT=#useAmount#
    WHERE ID=#id#
    </update>
      

  3.   

    楼上的兄台,请仔细看一下我的问题描述,ResultMap我已经配置了,但问题是
    <isNotEmpty prepend="AND" property="areaId"> 
    (EXISTS (SELECT 1 
              FROM (SELECT B.AREAID 
                      FROM PUB_AREA B 
                    CONNECT BY PRIOR B.AREAID = B.PARENTID 
                    START WITH B.AREAID IN 
                                (SELECT A.AREAID 
                                  FROM PUB_AREA A 
                                  WHERE INSTRB('$' || #areaId# || '$', 
                                              '$' || A.AREAID || '$') > 0)) T 
            WHERE T.AREAID = C.AREAID)) 
    </isNotEmpty> 对于这一段,当传入值时,IBATIS执行才会报上面的错,你也说了IBATIS把'' || ? || '' 当成名字解释了,关系是为什么会当作名字来解释呢?
    而对于
    <isNotEmpty prepend="AND" property="userCode"> 
    (C.USERCODE LIKE '%' || #userCode# || '%') 
    </isNotEmpty> 
    <isNotEmpty prepend="AND" property="userName"> 
    (C.USERNAME LIKE '%' || #userName# || '%') 
    </isNotEmpty> 
    这两个条件执行却又正常呢?