VARCHAR2 and NUMBER are not valid JDBC types.  These are Oracle
specific.  You need to specify the correct JDBC equivalent.  See here
for the valid values:

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Types.html

Also, if you use a declared parameter map, then you must change the
parameter markers to question marks.

Jeff Butler


On Tue, Feb 2, 2010 at 2:03 AM, rajnishp <hi_rajn...@yahoo.com> wrote:
>
> Thanks Clinton,
>
> Larry FYI my SqlMAp for insert is like
> <insert id="insertAllocationInstruction"
> parameterClass="com.sungard.cliq.dto.AllocationDTO" >
>                <selectKey resultClass="int" keyProperty="allocationID">
>                        SELECT ALLOCATION_INSTRUCTION_SEQ.NextVal FROM DUAL
>                </selectKey>
>
>                INSERT INTO ALLOCATION_INSTRUCTION
>                (
>                ALLOCATION_INSTRUCTION_ID,
>                CLEARING_BROKER,
>                EXTERNAL_ACCOUNT_ID,
>                ACCOUNT_NAME,
>                ACCOUNT_ID,
>                QUANTITY,
>                PRICE,
>                USER_LOGIN_NAME,
>                USER_ID,
>                ENTITY_ID,
>                CREATED_BY
>                )
>                VALUES
>                (
>                #allocationID# ,
>                #clearingBroker# ,
>                #externalAccountID#,
>                #accountName#,
>                #accountID#,
>                #quantity#,
>                #price#,
>                #userLoginName#,
>                #userID:NUMBER#,
>                #entityID#,
>                #createdBy#
>                )
>
> here I have set Inline parameter for userID as NUMBER
>
> But still it is throwing same exception, when we looked in issue we found it
> was working fine with primitives int ,long, double and String but it was
> throwing same exception with wrappers of Integer, Long, Double.
> For our requirement POJO uses Wrappers attributes.
>
> I also tried to resolve this issue by using parameterMap
>
> <parameterMap id="insertAllocationInstructionParameterMap"
> class="com.sungard.cliq.dto.AllocationDTO">
> <parameter property="allocationID"              javaType="java.lang.Integer"
> jdbcType="NUMBER"/>
> <parameter property="clearingBroker"    javaType="java.lang.String"
> jdbcType="VARCHAR2"/>
> <parameter property="externalAccountID" javaType="java.lang.String"
> jdbcType="VARCHAR2"/>
> <parameter property="accountName"               javaType="java.lang.String"
> jdbcType="VARCHAR2"/>
> <parameter property="accountID"                 javaType="java.lang.Long"
> jdbcType="NUMBER"/>
> <parameter property="quantity"          javaType="java.lang.Long"
> jdbcType="NUMBER"/>
> <parameter property="price"             javaType="java.math.BigDecimal"
> jdbcType="NUMBER"/>
> <parameter property="userLoginName"     javaType="java.lang.String"
> jdbcType="VARCHAR2"/>
> <parameter property="userID"            javaType="java.lang.Integer"
> jdbcType="NUMBER"/>
> <parameter property="entityID"          javaType="java.lang.Long"
> jdbcType="NUMBER"/>
> <parameter property="createdBy"                 javaType="java.lang.String"
> jdbcType="VARCHAR2"/>
> </parameterMap>
>
>
> <insert id="insertAllocationInstruction"
> parameterClass="com.sungard.cliq.dto.AllocationDTO"
> parameterMap="insertAllocationInstructionParameterMap">
>                <selectKey resultClass="int" keyProperty="allocationID">
>                        SELECT ALLOCATION_INSTRUCTION_SEQ.NextVal FROM DUAL
>                </selectKey>
>
>                INSERT INTO ALLOCATION_INSTRUCTION
>                (
>                ALLOCATION_INSTRUCTION_ID,
>                CLEARING_BROKER,
>                EXTERNAL_ACCOUNT_ID,
>                ACCOUNT_NAME,
>                ACCOUNT_ID,
>                QUANTITY,
>                PRICE,
>                USER_LOGIN_NAME,
>                USER_ID,
>                ENTITY_ID,
>                CREATED_BY
>                )
>                VALUES
>                (
>                #allocationID# ,
>                #clearingBroker# ,
>                #externalAccountID#,
>                #accountName#,
>                #accountID#,
>                #quantity#,
>                #price#,
>                #userLoginName#,
>                #userID#,
>                #entityID#,
>                #createdBy#
>                )
>
> But stiil it is giving
>
> java.sql.BatchUpdateException: ORA-00911: invalid character
>
>
>
> Clinton Begin wrote:
>>
>> Using null value replacement like #id:NUMERIC:-999999# doesn't act like a
>> default value.  In fact, it acts quite the opposite way.  It was
>> originally
>> implemented to allow nullable fields in the database to be mapped to
>> primitive Java types (non-nullable).  Because it was so hard to
>> understand,
>> it's been removed in iBATIS 3.
>>
>> So, that won't help you.
>>
>> Based on your comment and without your code, it seems to me you're asking
>> how to avoid a SQL exception when you don't pass in a parameter.
>> Unfortunately, you have to pass in every parameter that you specify.  You
>> would get the same error with plain JDBC.
>>
>> Clinton
>>
>> On Mon, Feb 1, 2010 at 2:51 AM, rajnishp <hi_rajn...@yahoo.com> wrote:
>>
>>>
>>> Hi,
>>> IBatis throws SQL exception while inserting data using InlineParameterMap
>>> :--
>>>
>>> The error occurred while applying a parameter map.
>>> --- Check the insertAllocationInstruction-InlineParameterMap.
>>> --- Check the parameter mapping for the 'userID' property.
>>> --- Cause: java.sql.SQLException: Invalid column type
>>>
>>> Ibatis throws error because the attribute userID is not set while
>>> inserting
>>> data in database(Oracle 10g).
>>> After doing googling I got help in
>>> http://ibatisnet.sourceforge.net/DevGuide.html
>>> Solution provided :--
>>>                      <statement id=”insertProduct”
>>> parameterClass=”product”>
>>>                       insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
>>>                      values (#id:NUMERIC:-999999#,
>>> #description:VARCHAR:NO_ENTRY#);
>>>                      </statement>
>>> Providing Default value if attribut not set.
>>>
>>> This solution is not working.
>>>
>>> Please provided correct solution solution (Only by IBatis not setting
>>> default value in POJO)
>>>
>>> Thanking In Advance.
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/IBatis2.3.4-throws-%3A-java.sql.SQLException%3A-Invalid-column-type-when-property-is-not-set-in-POJO-while-inserting-data.-tp27401733p27401733.html
>>> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
>>> For additional commands, e-mail: dev-h...@ibatis.apache.org
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/IBatis2.3.4-throws-%3A-java.sql.SQLException%3A-Invalid-column-type-when-property-is-not-set-in-POJO-while-inserting-data.-tp27401733p27416662.html
> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: dev-h...@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
For additional commands, e-mail: dev-h...@ibatis.apache.org

Reply via email to