Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 求助,一个关于IBATIS的parameterMap的问题!
julian





发贴: 5
积分: 0
于 2006-04-05 10:54 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
插入记录的时候,原本用parameterClass,能成功插入记录,但是不能插入NULL值.
为了插入NULL值,使用parameter的nullValue属性,用了parameterMap.代码如下:
  <parameterMap class="Faq" id="Faq-insert" >
    <parameter
      property="qid"
    />
    <parameter
      property="classification"
    />
    <parameter
      property="question"
    />
    <parameter
      property="detailqa"
    />
    <parameter
      property="status"
    />
    <parameter
      property="lang"
    />
    <parameter
      property="infoupdatedt"
      jdbcType="TIMESTAMP"
    />
    <parameter
      property="keyword"
      jdbcType="VARCHAR"
    />
    <parameter
      property="deleteflg"
      javaType="int"
      jdbcType="NUMERIC"
      nullValue="-9"
    />
    <parameter
      property="createOuCode"
    />
    <parameter
      property="createOuName"
    />
    <parameter
      property="createUserId"
    />
    <parameter
      property="createUserName"
    />
    <parameter
      property="createDate"
      jdbcType="TIMESTAMP"
    />
    <parameter
      property="updateOuCode"
    />
    <parameter
      property="updateOuName"
    />
    <parameter
      property="updateUserId"
    />
    <parameter
      property="updateUserName"
    />
    <parameter
      property="updateDate"
      jdbcType="TIMESTAMP"
    />
  </parameterMap>

  <insert id="insertFaq"
    parameterMap="Faq-insert">
      INSERT INTO TNSFP1001_FAQ
        (ID,
        QID,
        CLASSIFICATION,
        QUESTION,
        DETAILQA,
        INFOUPDATEDT,
        STATUS,
        KEYWORD,
        LANG,
        DELETEFLG,
        CREATEOUCD,
        CREATEOUNM,
        CREATEUID,
        CREATEUNM,
        CREATEDT,
        UPDATEOUCD,
        UPDATEOUNM,
        UPDATEUID,
        UPDATEUNM,
        UPDATEDT)
      VALUES
        (QNSFP1001_FAQ.NEXTVAL,
        #qid:VARCHAR#,
        #classification:NUMBER#,
        #question:VARCHAR#,
        #detailqa:VARCHAR#,
        #infoupdatedt:TIMESTAMP#,
        #status:VARCHAR#,
        #keyword:VARCHAR#,
        #lang:VARCHAR#,
        #deleteflg:NUMBER#,
        #createOuCode:VARCHAR#,
        #createOuName:VARCHAR#,
        #createUserId:VARCHAR#,
        #createUserName:VARCHAR#,
        #createDate:TIMESTAMP#,
        #updateOuCode:VARCHAR#,
        #updateOuName:VARCHAR#,
        #updateUserId:VARCHAR#,
        #updateUserName:VARCHAR#,
        #updateDate:TIMESTAMP#)
  </insert>

但是运行时总会报以下这个错误:
nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in /entity/faq/dao/Faq.xml.
--- The error occurred while applying a parameter map.
--- Check the Faq-insert.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-00911: 文字が無効です。
我把那些有NULL值的和日期的字段都删除过,也有这样的错,不知道原因在什么地方.请求高人帮助.
小弟先谢谢各位大侠啦!




话题树型展开
人气 标题 作者 字数 发贴时间
12504 求助,一个关于IBATIS的parameterMap的问题! julian 2618 2006-04-05 10:54

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923